X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fclass%2Fcorlib%2FSystem.Reflection%2FMonoField.cs;h=117eea363fd520e7c1998c4aedd28d2f0f580a37;hb=c7ba3619f367944b6740c7e335e2a96499999859;hp=7fe23e6b737e2b65030a19d9259472ef8240bcac;hpb=457a8453f7a0b58d2eae114e3476e62765f9502a;p=mono.git diff --git a/mcs/class/corlib/System.Reflection/MonoField.cs b/mcs/class/corlib/System.Reflection/MonoField.cs index 7fe23e6b737..117eea363fd 100644 --- a/mcs/class/corlib/System.Reflection/MonoField.cs +++ b/mcs/class/corlib/System.Reflection/MonoField.cs @@ -41,9 +41,24 @@ using System.Runtime.Serialization; namespace System.Reflection { + abstract class RuntimeFieldInfo : FieldInfo + { + internal BindingFlags BindingFlags { + get { + return 0; + } + } + } + + abstract class RtFieldInfo : RuntimeFieldInfo + { + [MethodImplAttribute(MethodImplOptions.InternalCall)] + internal extern object UnsafeGetValue (object obj); + } + [Serializable] [StructLayout (LayoutKind.Sequential)] - internal class MonoField : FieldInfo, ISerializable { + internal class MonoField : RtFieldInfo, ISerializable { internal IntPtr klass; internal RuntimeFieldHandle fhandle; string name; @@ -146,10 +161,11 @@ namespace System.Reflection { if (IsLiteral) throw new FieldAccessException ("Cannot set a constant field"); if (binder == null) - binder = Binder.DefaultBinder; + binder = Type.DefaultBinder; CheckGeneric (); if (val != null) { - val = binder.ConvertValue (val, FieldType, culture, (invokeAttr & BindingFlags.ExactBinding) != 0); + RuntimeType fieldType = (RuntimeType) FieldType; + val = fieldType.CheckValue (val, binder, culture, invokeAttr); } SetValueInternal (this, obj, val); } @@ -175,11 +191,9 @@ namespace System.Reflection { [MethodImplAttribute(MethodImplOptions.InternalCall)] public override extern object GetRawConstantValue (); -#if NET_4_0 public override IList GetCustomAttributesData () { return CustomAttributeData.GetCustomAttributes (this); } -#endif void CheckGeneric () { if (DeclaringType.ContainsGenericParameters)