상속: FieldInfo, ISerializable
        internal MonoField Clone(string newName)
        {
            MonoField field = new MonoField();

            field.name    = newName;
            field.type    = type;
            field.attrs   = attrs;
            field.klass   = klass;
            field.fhandle = fhandle;
            return(field);
        }
예제 #2
0
 public override void SetValue(object obj, object val, BindingFlags invokeAttr, Binder binder, CultureInfo culture)
 {
     if (!this.IsStatic)
     {
         if (obj == null)
         {
             throw new TargetException("Non-static field requires a target");
         }
         if (!this.DeclaringType.IsAssignableFrom(obj.GetType()))
         {
             throw new ArgumentException(string.Format("Field {0} defined on type {1} is not a field on the target object which is of type {2}.", this.Name, this.DeclaringType, obj.GetType()), "obj");
         }
     }
     if (this.IsLiteral)
     {
         throw new FieldAccessException("Cannot set a constant field");
     }
     if (binder == null)
     {
         binder = Binder.DefaultBinder;
     }
     this.CheckGeneric();
     if (val != null)
     {
         object obj2 = binder.ChangeType(val, this.type, culture);
         if (obj2 == null)
         {
             throw new ArgumentException(string.Concat(new object[]
             {
                 "Object type ",
                 val.GetType(),
                 " cannot be converted to target type: ",
                 this.type
             }), "val");
         }
         val = obj2;
     }
     MonoField.SetValueInternal(this, obj, val);
 }
예제 #3
0
		internal MonoField Clone (string newName)
		{
			MonoField field = new MonoField ();
			field.name = newName;
			field.type = type;
			field.attrs = attrs;
			field.klass = klass;
			field.fhandle = fhandle;
			return field;
		}
 internal static extern int get_metadata_token(MonoField monoField);