[ Team LiB ] Previous Section Next Section

FieldInfoCF 1.0, ECMA 1.0, serializable

System.Reflection (mscorlib.dll)abstract class

This class is an implementation of MemberInfo and allows access to an instance field. Note that, like all reflective objects, the FieldInfo instance refers to the metadata concept of the field within the type, not a particular field within a particular instance of that type. (This is important when working with or manipulating the value stored in object instance fields.)

IsAssembly, IsFamily, IsFamilyAndAssembly, IsFamilyOrAssembly, IsPublic, and IsPrivate allow you to check the visibility of the field. FieldType returns the declared type of this field. FieldHandle is a System.RuntimeFieldHandle. Use Attributes to retrieve the attributes. To see if the FieldInfo has the NotSerialized or PinvokeImplFieldAttributes set, inspect the IsNotSerialized and IsPinvokeImpl properties. If the field is static, IsStatic is true. The Set and Get methods allow you set the values, and the ones with Direct in their name take a typed reference as opposed to an object.

public abstract class FieldInfo : MemberInfo {
// Protected Constructors
   protected FieldInfo( );
// Public Instance Properties
   public abstract FieldAttributes Attributes{get; }
   public abstract RuntimeFieldHandle FieldHandle{get; }
   public abstract Type FieldType{get; }
   public bool IsAssembly{get; }
   public bool IsFamily{get; }
   public bool IsFamilyAndAssembly{get; }
   public bool IsFamilyOrAssembly{get; }
   public bool IsInitOnly{get; }
   public bool IsLiteral{get; }
   public bool IsNotSerialized{get; }
   public bool IsPinvokeImpl{get; }
   public bool IsPrivate{get; }
   public bool IsPublic{get; }
   public bool IsSpecialName{get; }
   public bool IsStatic{get; }
   public override MemberTypes MemberType{get; }      
// overrides MemberInfo
// Public Static Methods
   public static FieldInfo GetFieldFromHandle(RuntimeFieldHandle handle);
// Public Instance Methods
   public abstract object GetValue(object obj);
   public virtual object GetValueDirect(TypedReference obj);
   public void SetValue(object obj, object value);
   public abstract void SetValue(object obj, object value, BindingFlags invokeAttr, Binder binder,
       System.Globalization.CultureInfo culture);
   public virtual void SetValueDirect(TypedReference obj, object value);
}

Hierarchy

System.Object MemberInfo(ICustomAttributeProvider) FieldInfo

Subclasses

System.Reflection.Emit.FieldBuilder

Returned By

Binder.BindToField( ), IReflect.{GetField( ), GetFields( )}, Module.{GetField( ), GetFields( )}, System.Runtime.InteropServices.Expando.IExpando.AddField( ), System.Type.{GetField( ), GetFields( )}

Passed To

Binder.BindToField( ), System.Reflection.Emit.CustomAttributeBuilder.CustomAttributeBuilder( ), System.Reflection.Emit.ILGenerator.{Emit( ), EmitWriteLine( )}, System.Reflection.Emit.ModuleBuilder.GetFieldToken( )

    [ Team LiB ] Previous Section Next Section