Reflection mscorlib [00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00 ] 1.0.5000.0 2.0.0.0 4.0.0.0 All public static members of this type are safe for multithreaded operations. No instance members are guaranteed to be thread safe. System.Reflection.MemberInfo System.Runtime.InteropServices._FieldInfo System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.None) System.Runtime.InteropServices.ComDefaultInterface(typeof(System.Runtime.InteropServices._FieldInfo)) System.Runtime.InteropServices.ComVisible(true)

The field information is obtained from metadata. The class does not have a public constructor. objects are obtained by calling either the or method of a Type object.

Fields are variables defined in the class. provides access to the metadata for a field within a class and provides dynamic set and get functionality for the field. The class is not loaded into memory until invoke or get is called on the object.

Discovers the attributes of a field and provides access to field metadata.

- Constructor
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  To be added.

  Initializes a new instance of the FieldInfo class.

  0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Reflection.FieldAttributes

  A value that indicates the attributes of the field reflected by the current instance.

  The following example demonstrates obtaining the attributes of two fields.

  `using System; using System.Reflection; class MyClass { public int MyPublicInstanceField; private const int MyPrivateConstField = 10; } class FieldAttributesExample { public static void Main() { Type t = (typeof(MyClass)); string str; FieldInfo[] fiAry = t.GetFields( BindingFlags.Static | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.DeclaredOnly ); foreach (FieldInfo fi in fiAry) { Console.WriteLine("Field {0} is: ", fi.Name); str = ((fi.Attributes & FieldAttributes.Static) != 0) ? "Static" : "Instance"; Console.Write(str + " "); str = ((fi.Attributes & FieldAttributes.Public) != 0) ? "Public" : "Not-Public"; Console.Write(str + " "); str = ((fi.Attributes & FieldAttributes.Literal) != 0) ? "Literal" : String.Empty; Console.WriteLine(str); } } }`

  The output is

  Field MyPublicInstanceField is:

  Instance Public

  Field MyPrivateConstField is:

  Static Not-Public Literal

  All members have a set of attributes, which are defined in relation to the specific type of member. FieldAttributes informs the user whether this field is the private field, a static field, and so on.

  To get the Attributes property, first get the class Type. From the Type, get the FieldInfo. From the FieldInfo, get the Attributes.

  Gets the attributes associated with this field.

  0
- Method
  4.0.0.0
  System.Boolean `` To be added.

  Returns a value that indicates whether this instance is equal to a specified object.

  true if equals the type and value of this instance; otherwise, false.

  An object to compare with this instance, or null.
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.RuntimeFieldHandle To be added.

  The handles are valid only in the appdomain in which they were obtained.

  Gets a RuntimeFieldHandle, which is a handle to the internal metadata representation of a field.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Type

  The of the field reflected by the current instance.

  The type is some primitive data type, such as String, Boolean, or GUID.

  To get the FieldType property, first get the class Type. From the Type, get the FieldInfo. From the FieldInfo, get the FieldType value.

  Gets the type of this field object.

  0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Reflection.FieldInfo ``

  Handles are valid only in the application domain in which they were obtained.

  Gets a for the field represented by the specified handle.

  A object representing the field specified by .

  A structure that contains the handle to the internal metadata representation of a field.
- Method
  2.0.0.0
  4.0.0.0
  System.Runtime.InteropServices.ComVisible(false)
  System.Reflection.FieldInfo `` ``

  Handles are valid only in the application domain in which they were obtained.

  The recommended practice is that should always be the runtime type handle of the constructed type that belongs to. That is, if is a runtime field handle for a field that belongs to MyType<int> (MyType(Of Integer) in Visual Basic), is the runtime type handle for MyType<int>. Do not use the runtime type handle of the generic type definition, unless the runtime field handle represents a field on the generic type definition.

  Implementations are compatible in some cases. For example, a single implementation is shared by all types that are constructed from a particular generic type definition by using reference types for the generic type arguments. For example, MyType<string>, MyType<object>, and MyType<ArrayList> all share the same implementation. In this situation, the object that is returned represents a field on the type that specifies, regardless of the original source of . This practice is not recommended, because it works only if the generic type arguments of the constructed type are reference types.

  If a generic argument is a value type, the runtime type handle of the constructed type is not compatible with runtime field handles from constructions that have a reference type in the same generic parameter position, or that have a different value type in that position. In that case, the only way to use the overload is to ensure that is the runtime type handle for the constructed type that belongs to.

  Gets a for the field represented by the specified handle, for the specified generic type.

  A object representing the field specified by , in the generic type specified by .

  A structure that contains the handle to the internal metadata representation of a field. A structure that contains the handle to the generic type that defines the field.
- Method
  4.0.0.0
  System.Int32 To be added.

  Returns the hash code for this instance.

  A 32-bit signed integer hash code.

- Method
  2.0.0.0
  4.0.0.0
  System.Type[]

  The and methods are provided for designers of managed compilers. For more information on custom modifiers, see and related classes in the namespace and the metadata specification in the ECMA Partition II documentation. The documentation is available online; see ECMA C# and Common Language Infrastructure Standards on MSDN and Standard ECMA-335 - Common Language Infrastructure (CLI) on the Ecma International Web site.

  Gets an array of types that identify the optional custom modifiers of the field.

  An array of objects that identify the optional custom modifiers of the current field, such as .

- Method
  2.0.0.0
  4.0.0.0
  System.Object

  This method is provided for designers of managed compilers and code analyzers.

  This method can be used in both the execution context and the reflection-only context.

  In unmanaged metadata, the Constant table is used to store constant values for fields, parameters, and properties. Constant information does not directly influence runtime behavior. Compilers inspect this information, at compile time, when importing metadata. If used, the value of a constant is embedded in the Microsoft intermediate language (MSIL) stream the compiler emits. There are no MSIL instructions that can be used to access the Constant table at run time.

  For more information on constant values and the Constant table, see the ECMA Partition II documentation. The documentation is available online; see ECMA C# and Common Language Infrastructure Standards on MSDN and Standard ECMA-335 - Common Language Infrastructure (CLI) on the Ecma International Web site.

  Returns a literal value associated with the field by a compiler.

  An that contains the literal value associated with the field. If the literal value is a class type with an element value of zero, the return value is null.

- Method
  2.0.0.0
  4.0.0.0
  System.Type[]

  The and methods are provided for designers of managed compilers. For more information on custom modifiers, see and related classes in the namespace and the metadata specification in the ECMA Partition II documentation. The documentation is available online; see ECMA C# and Common Language Infrastructure Standards on MSDN and Standard ECMA-335 - Common Language Infrastructure (CLI) on the Ecma International Web site.

  Gets an array of types that identify the required custom modifiers of the property.

  An array of objects that identify the required custom modifiers of the current property, such as or .

- Method
  System.Type To be added. To be added. To be added. 1.0.5000.0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Object `` A field is marked literal, but the field does not have one of the accepted literal types. For information regarding the accepted literal types, see Partition II of the CLI Specification. The field reflected by the current instance is non-public, and the caller does not have permission to access non-public members. The field reflected by the current instance is declared neither directly in nor in any class from which derives. The field reflected by the current instance is non-static, and is . Requires permission to access non-public members of a type in loaded assemblies. See .

  If the field is static, is ignored. For non-static fields, should be an instance of a class that inherits or declares the field. Note that the return type of GetValue is Object. For example, if the field holds a Boolean primitive value, an instance of Object with the appropriate Boolean value is returned. Before returning the value, GetValue checks to see if the user has access permission.

  Access restrictions are ignored for fully trusted code. That is, private constructors, methods, fields, and properties can be accessed and invoked through reflection whenever the code is fully trusted.

  Starting with the net_v20sp1_long, this method can be used to access non-public members if the caller has been granted with the flag and if the grant set of the non-public members is restricted to the caller’s grant set, or a subset thereof. (See Security Considerations for Reflection.)

  To use this functionality, your application should target the net_v35_long or later.

  When overridden in a derived class, returns the value of a field supported by a given object.

  An object containing the value of the field reflected by this instance.

  The object whose field value will be returned. 0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.CLSCompliant(false)
  System.Object `` To be added.

  Returns the value of a field supported by a given object.

  An Object containing a field value.

  A structure that encapsulates a managed pointer to a location and a runtime representation of the type that might be stored at that location.
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean To be added.

  The actual visibility of a field is limited by the visibility of its type. The property might be true for a field, but if it is a field of a private nested type then the field is not visible outside the containing type.

  The visibility of a field is exactly described by if the only visibility modifier is internal (Friend in Visual Basic). This property is false for fields that are protected internal in C# (Protected Friend in Visual Basic, protected public in C++); use the property to identify such fields.

  Gets a value indicating whether the potential visibility of this field is described by ; that is, the field is visible at most to other types in the same assembly, and is not visible to derived types outside the assembly.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean To be added.

  The visibility of a field is exactly described by if the only visibility modifier is protected. This property is false for fields that are protected internal in C# (Protected Friend in Visual Basic, protected public in C++); use the property to identify such fields.

  Gets a value indicating whether the visibility of this field is described by ; that is, the field is visible only within its class and derived classes.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean To be added.

  If a field has level visibility, it can be called from any member in a derived class that is also in the same assembly, but not from any other type.

  The visibility of a field is exactly described by if the visibility modifier is protected private in C++. Fields with this visibility cannot be defined in Visual Basic or C#.

  Gets a value indicating whether the visibility of this field is described by ; that is, the field can be accessed from derived classes, but only if they are in the same assembly.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean To be added.

  If a field has level visibility, it can be called from any member in a derived class or any member in the same assembly, but not from any other type.

  The actual visibility of a field is limited by the visibility of its type. The property might be true for a field, but if it is a field of a private nested type then the field is not visible outside the containing type.

  The visibility of a field is exactly described by if the visibility modifier is protected internal in C# (Protected Friend in Visual Basic, protected public in C++).

  Gets a value indicating whether the potential visibility of this field is described by ; that is, the field can be accessed by derived classes wherever they are, and by classes in the same assembly.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean To be added.

  If the returned value is true, the field can only be initialized, and is read-only thereafter.

  To get the IsInitOnly property, first get the class Type. From the Type, get the FieldInfo. From the FieldInfo, get the IsInitOnly property. To access a non-public field, combine with either or both of and in the GetField method.

  The IsInitOnly property is set when the attribute is set.

  Gets a value indicating whether the field can only be set in the body of the constructor.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean To be added.

  The IsLiteral property is set when the FieldAttributes.Literal attribute is set. If this attribute is set, the field cannot be changed and is constant.

  Gets a value indicating whether the value is written at compile time and cannot be changed.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean To be added.

  The IsNotSerialized property returns true when the field is marked with the FieldAttributes.NotSerialized flag. When this flag is set on a field, it indicates that the field does not have to be serialized when the type is remoted.

  Gets a value indicating whether this field has the NotSerialized attribute.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean To be added. To be added.

  Gets a value indicating whether the corresponding PinvokeImpl attribute is set in .

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean To be added.

  Private fields are accessible only from member functions.

  The IsPrivate property is set when the FieldAttributes.Private attribute is set.

  To get the IsPrivate property, first get the class Type. From the Type, get the FieldInfo. From the FieldInfo, get the IsPrivate property. To access a non-public field, set the BindingFlags to NonPublic, and either Static or Instance in the GetField method.

  Gets a value indicating whether the field is private.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean To be added.

  Public fields are accessible everywhere their corresponding classes are visible.

  The IsPublic property is set when the FieldAttributes.Public attribute is set.

  To get the IsPublic property, first get the class Type. From the Type, get the FieldInfo. From the FieldInfo, get the IsPublic property. If the field is other than public, it is protected and cannot be readily accessed. To access a nonpublic field, set the BindingFlags to NonPublic, specify either BindingFlags.Instance or BindingFlags.Static, and use this for the GetField method.

  Gets a value indicating whether the field is public.

- Property
  4.0.0.0
  System.Boolean To be added.

  The , , and properties report the transparency level of the field at its current trust level, as determined by the common language runtime (CLR). The combinations of these properties are shown in the following table:

  Security level

  IsSecurityCritical

  IsSecuritySafeCritical

  IsSecurityTransparent

  Critical

  true

  false

  false

  Safe critical

  true

  true

  false

  Transparent

  false

  false

  true

  Using these properties is much simpler than examining the security annotations of an assembly and its types and members, checking the current trust level, and attempting to duplicate the runtime's rules.

  For partial-trust assemblies, the value of this property depends on the current trust level of the assembly. If the assembly is loaded into a partially trusted application domain (for example, into a sandboxed application domain), then the runtime ignores the security annotations of the assembly. The assembly and all its types are treated as transparent. The runtime pays attention to the security annotations of a partial-trust assembly only when that assembly is loaded into a fully trusted application domain (for example, into the default application domain of a desktop application). By contrast, a trusted assembly (that is, a strong-named assembly that is installed in the global assembly cache) is always loaded with full trust regardless of the trust level of the application domain, so its current trust level is always fully trusted. You can determine the current trust levels of assemblies and application domains by using the and properties.

  For more information about reflection and transparency, see Security Considerations for Reflection. For information about transparency, see Security Changes in the .NET Framework Version 4.0.

  Gets a value that indicates whether the current field is security-critical or security-safe-critical at the current trust level.

- Property
  4.0.0.0
  System.Boolean To be added.

  The , , and properties report the transparency level of the field at its current trust level, as determined by the common language runtime (CLR). The combinations of these properties are shown in the following table:

  Security level

  IsSecurityCritical

  IsSecuritySafeCritical

  IsSecurityTransparent

  Critical

  true

  false

  false

  Safe critical

  true

  true

  false

  Transparent

  false

  false

  true

  Using these properties is much simpler than examining the security annotations of an assembly and its types and members, checking the current trust level, and attempting to duplicate the runtime's rules.

  For partial-trust assemblies, the value of this property depends on the current trust level of the assembly. If the assembly is loaded into a partially trusted application domain (for example, into a sandboxed application domain), then the runtime ignores the security annotations of the assembly. The assembly and all its types are treated as transparent. The runtime pays attention to the security annotations of a partial-trust assembly only when that assembly is loaded into a fully trusted application domain (for example, into the default application domain of a desktop application). By contrast, a trusted assembly (that is, a strong-named assembly that is installed in the global assembly cache) is always loaded with full trust regardless of the trust level of the application domain, so its current trust level is always fully trusted. You can determine the current trust levels of assemblies and application domains by using the and properties.

  For more information about reflection and transparency, see Security Considerations for Reflection. For information about transparency, see Security Changes in the .NET Framework Version 4.0.

  Gets a value that indicates whether the current field is security-safe-critical at the current trust level.

- Property
  4.0.0.0
  System.Boolean To be added.

  The , , and properties report the transparency level of the field at its current trust level, as determined by the common language runtime (CLR). The combinations of these properties are shown in the following table:

  Security level

  IsSecurityCritical

  IsSecuritySafeCritical

  IsSecurityTransparent

  Critical

  true

  false

  false

  Safe critical

  true

  true

  false

  Transparent

  false

  false

  true

  Using these properties is much simpler than examining the security annotations of an assembly and its types and members, checking the current trust level, and attempting to duplicate the runtime's rules.

  For partial-trust assemblies, the value of this property depends on the current trust level of the assembly. If the assembly is loaded into a partially trusted application domain (for example, into a sandboxed application domain), then the runtime ignores the security annotations of the assembly. The assembly and all its types are treated as transparent. The runtime pays attention to the security annotations of a partial-trust assembly only when that assembly is loaded into a fully trusted application domain (for example, into the default application domain of a desktop application). By contrast, a trusted assembly (that is, a strong-named assembly that is installed in the global assembly cache) is always loaded with full trust regardless of the trust level of the application domain, so its current trust level is always fully trusted. You can determine the current trust levels of assemblies and application domains by using the and properties.

  For more information about reflection and transparency, see Security Considerations for Reflection. For information about transparency, see Security Changes in the .NET Framework Version 4.0.

  Gets a value that indicates whether the current field is transparent at the current trust level.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean To be added.

  Names that begin with or contain an underscore character (_), property accessors, and operator overloading methods are examples of names that might require special treatment by some compilers.

  Gets a value indicating whether the corresponding SpecialName attribute is set in the enumerator.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean To be added.

  When a field is static, one copy of the field is shared by all instances of the type.

  The IsStatic property is set when the FieldAttributes.Static attribute is set.

  To get the IsStatic property, first get the class Type. From the Type, get the FieldInfo. From the FieldInfo, get the IsStatic property. To access a non-public field, set the BindingFlags to NonPublic in the GetField method and set the accessibility to Instance or Static.

  Gets a value indicating whether the field is static.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Reflection.MemberTypes To be added.

  This property overrides . Therefore, when you examine a set of objects — for example, the array returned by — the property returns only when a given member is a field.

  Gets a value indicating that this member is a field.

- Method
  4.0.0.0
  System.Boolean `` `` To be added.

  Indicates whether two objects are equal.

  true if is equal to ; otherwise, false.

  The first object to compare. The second object to compare.
- Method
  4.0.0.0
  System.Boolean `` `` To be added.

  Indicates whether two objects are not equal.

  true if is not equal to ; otherwise, false.

  The first object to compare. The second object to compare.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Diagnostics.DebuggerStepThrough
  System.Void `` ``

  The field reflected by the current instance is declared neither directly in nor in any class from which derives.

  is not assignment-compatible with the type of the field reflected by the current instance.

  The field reflected by the current instance is non-public, and the caller does not have permission to access non-public members. The field reflected by the current instance is non-static, and is . Requires permission to access non-public members of a type in loaded assemblies. See . The value to assign to the field.

  This method will assign to the field reflected by this instance on object . If the field is static, will be ignored. For non-static fields, should be an instance of a class that inherits or declares the field. The new value is passed as an Object. For example, if the field's type is Boolean, an instance of Object with the appropriate Boolean value is passed. Before setting the value, SetValue checks to see if the user has access permission. This final method is a convenience method for calling the following SetValue method.

  Fully trusted code has the permissions that are needed to access and invoke private constructors, methods, fields, and properties using reflection.

  Starting with the net_v20sp1_long, this method can be used to access non-public members if the caller has been granted with the flag and if the grant set of the non-public members is restricted to the caller’s grant set, or a subset thereof. (See Security Considerations for Reflection.)

  To use this functionality, your application should target the net_v35_long or later.

  Sets the value of the field supported by the given object.

  The object whose field value will be set. The value to assign to the field. 0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void `` `` `` `` ``

  The field reflected by the current instance is declared neither directly in nor in any class from which derives.

  is not assignment-compatible with the type of the field reflected by the current instance.

  The field reflected by the current instance is non-public, and the caller does not have permission to access non-public members. The field reflected by the current instance is non-static, and is . Requires permission to access non-public members of a type in loaded assemblies. See . A field of Binder that specifies the type of binding that is desired (for example, Binder.CreateInstance or Binder.ExactBinding). A set of properties that enables the binding, coercion of argument types, and invocation of members through reflection. If is null, then Binder.DefaultBinding is used. The software preferences of a particular culture.

  This method will assign to the field reflected by this instance on . If the field is static, will be ignored. For non-static fields, should be an instance of a class that inherits or declares the field. The new value is passed as an Object. For example, if the field's type is Boolean, an instance of Object with the appropriate Boolean value is passed. Before setting the value, SetValue checks to see if the user has access permission.

  Fully trusted code has the permissions that are needed to access and invoke private constructors, methods, fields, and properties using reflection.

  Starting with the net_v20sp1_long, this method can be used to access non-public members if the caller has been granted with the flag and if the grant set of the non-public members is restricted to the caller’s grant set, or a subset thereof. (See Security Considerations for Reflection.)

  To use this functionality, your application should target the net_v35_long or later.

  When overridden in a derived class, sets the value of the field supported by the given object.

  The object whose field value will be set. The value to assign to the field. A field of Binder that specifies the type of binding that is desired (for example, Binder.CreateInstance or Binder.ExactBinding). A set of properties that enables the binding, coercion of argument types, and invocation of members through reflection. If is null, then Binder.DefaultBinding is used. The software preferences of a particular culture. 0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.CLSCompliant(false)
  System.Void `` ``

  Starting with the net_v20sp1_long, this method can be used to access non-public members if the caller has been granted with the flag and if the grant set of the non-public members is restricted to the caller’s grant set, or a subset thereof. (See Security Considerations for Reflection.)

  To use this functionality, your application should target the net_v35_long or later.

  Sets the value of the field supported by the given object.

  A structure that encapsulates a managed pointer to a location and a runtime representation of the type that can be stored at that location. The value to assign to the field.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void `` `` `` `` `` To be added. To be added. To be added. To be added. To be added. To be added. To be added.
- Method
  4.0.0.0
  System.Type To be added.

  Gets a object representing the type.

  A object representing the type.

- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void `` `` ``

  This method is for access to managed classes from unmanaged code, and should not be called from managed code. For more information about IDispatch::GetTypeInfo, see the MSDN Library.

  Retrieves the type information for an object, which can then be used to get the type information for an interface.

  The type information to return. The locale identifier for the type information. Receives a pointer to the requested type information object.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void `` To be added. To be added. To be added.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void `` `` `` `` `` `` `` `` To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added.
0