mscorlib(4.0.0.0) API with additions
|
Discovers the attributes of a field and provides access to field metadata. More...
Public Member Functions | |
override bool | Equals (object obj) |
Returns a value that indicates whether this instance is equal to a specified object. More... | |
override int | GetHashCode () |
Returns the hash code for this instance. More... | |
virtual Type [] | GetRequiredCustomModifiers () |
Gets an array of types that identify the required custom modifiers of the property. More... | |
virtual Type [] | GetOptionalCustomModifiers () |
Gets an array of types that identify the optional custom modifiers of the field. More... | |
virtual void | SetValueDirect (TypedReference obj, object value) |
Sets the value of the field supported by the given object. More... | |
virtual object | GetValueDirect (TypedReference obj) |
Returns the value of a field supported by a given object. More... | |
abstract object | GetValue (object obj) |
When overridden in a derived class, returns the value of a field supported by a given object. More... | |
virtual object | GetRawConstantValue () |
Returns a literal value associated with the field by a compiler. More... | |
abstract void | SetValue (object obj, object value, BindingFlags invokeAttr, Binder binder, CultureInfo culture) |
When overridden in a derived class, sets the value of the field supported by the given object. More... | |
void | SetValue (object obj, object value) |
Sets the value of the field supported by the given object. More... | |
![]() | |
abstract object [] | GetCustomAttributes (bool inherit) |
When overridden in a derived class, returns an array of all custom attributes applied to this member. More... | |
abstract object [] | GetCustomAttributes (Type attributeType, bool inherit) |
When overridden in a derived class, returns an array of custom attributes applied to this member and identified by T:System.Type. More... | |
abstract bool | IsDefined (Type attributeType, bool inherit) |
When overridden in a derived class, indicates whether one or more attributes of the specified type or of its derived types is applied to this member. More... | |
virtual IList< CustomAttributeData > | GetCustomAttributesData () |
Returns a list of T:System.Reflection.CustomAttributeData objects representing data about the attributes that have been applied to the target member. More... | |
override bool | Equals (object obj) |
Returns a value that indicates whether this instance is equal to a specified object. More... | |
override int | GetHashCode () |
Returns the hash code for this instance. More... | |
![]() | |
new string | ToString () |
Provides COM objects with version-independent access to the M:System.Object.ToString method. More... | |
![]() | |
new string | ToString () |
Provides COM objects with version-independent access to the M:System.Object.ToString method. More... | |
object [] | GetCustomAttributes (Type attributeType, bool inherit) |
Provides COM objects with version-independent access to the M:System.Reflection.MemberInfo.GetCustomAttributes(System.Type,System.Boolean) method. More... | |
object [] | GetCustomAttributes (bool inherit) |
Provides COM objects with version-independent access to the M:System.Reflection.MemberInfo.GetCustomAttributes(System.Boolean) method. More... | |
bool | IsDefined (Type attributeType, bool inherit) |
Provides COM objects with version-independent access to the M:System.Reflection.MemberInfo.IsDefined(System.Type,System.Boolean) method. More... | |
Static Public Member Functions | |
static FieldInfo | GetFieldFromHandle (RuntimeFieldHandle handle) |
Gets a T:System.Reflection.FieldInfo for the field represented by the specified handle. More... | |
static FieldInfo | GetFieldFromHandle (RuntimeFieldHandle handle, RuntimeTypeHandle declaringType) |
Gets a T:System.Reflection.FieldInfo for the field represented by the specified handle, for the specified generic type. More... | |
static bool | operator== (FieldInfo left, FieldInfo right) |
Indicates whether two T:System.Reflection.FieldInfo objects are equal. More... | |
static bool | operator != (FieldInfo left, FieldInfo right) |
Indicates whether two T:System.Reflection.FieldInfo objects are not equal. More... | |
![]() | |
static bool | operator== (MemberInfo left, MemberInfo right) |
Indicates whether two T:System.Reflection.MemberInfo objects are equal. More... | |
static bool | operator != (MemberInfo left, MemberInfo right) |
Indicates whether two T:System.Reflection.MemberInfo objects are not equal. More... | |
Public Attributes | |
override MemberTypes | MemberType => MemberTypes.Field |
Gets a T:System.Reflection.MemberTypes value indicating that this member is a field. More... | |
bool | IsNotSerialized => (Attributes & FieldAttributes.NotSerialized) != FieldAttributes.PrivateScope |
Gets a value indicating whether this field has the NotSerialized attribute. More... | |
bool | IsPinvokeImpl => (Attributes & FieldAttributes.PinvokeImpl) != FieldAttributes.PrivateScope |
Gets a value indicating whether the corresponding PinvokeImpl attribute is set in T:System.Reflection.FieldAttributes. More... | |
virtual bool | IsSecurityCritical => FieldHandle.IsSecurityCritical() |
Gets a value that indicates whether the current field is security-critical or security-safe-critical at the current trust level. More... | |
virtual bool | IsSecuritySafeCritical => FieldHandle.IsSecuritySafeCritical() |
Gets a value that indicates whether the current field is security-safe-critical at the current trust level. More... | |
virtual bool | IsSecurityTransparent => FieldHandle.IsSecurityTransparent() |
Gets a value that indicates whether the current field is transparent at the current trust level. More... | |
Properties | |
abstract RuntimeFieldHandle | FieldHandle [get] |
Gets a RuntimeFieldHandle , which is a handle to the internal metadata representation of a field. More... | |
abstract Type | FieldType [get] |
Gets the type of this field object. More... | |
abstract FieldAttributes | Attributes [get] |
Gets the attributes associated with this field. More... | |
bool | IsPublic [get] |
Gets a value indicating whether the field is public. More... | |
bool | IsPrivate [get] |
Gets a value indicating whether the field is private. More... | |
bool | IsFamily [get] |
Gets a value indicating whether the visibility of this field is described by F:System.Reflection.FieldAttributes.Family; that is, the field is visible only within its class and derived classes. More... | |
bool | IsAssembly [get] |
Gets a value indicating whether the potential visibility of this field is described by F:System.Reflection.FieldAttributes.Assembly; 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. More... | |
bool | IsFamilyAndAssembly [get] |
Gets a value indicating whether the visibility of this field is described by F:System.Reflection.FieldAttributes.FamANDAssem; that is, the field can be accessed from derived classes, but only if they are in the same assembly. More... | |
bool | IsFamilyOrAssembly [get] |
Gets a value indicating whether the potential visibility of this field is described by F:System.Reflection.FieldAttributes.FamORAssem; that is, the field can be accessed by derived classes wherever they are, and by classes in the same assembly. More... | |
bool | IsStatic [get] |
Gets a value indicating whether the field is static. More... | |
bool | IsInitOnly [get] |
Gets a value indicating whether the field can only be set in the body of the constructor. More... | |
bool | IsLiteral [get] |
Gets a value indicating whether the value is written at compile time and cannot be changed. More... | |
bool | IsSpecialName [get] |
Gets a value indicating whether the corresponding SpecialName attribute is set in the T:System.Reflection.FieldAttributes enumerator. More... | |
![]() | |
abstract MemberTypes | MemberType [get] |
When overridden in a derived class, gets a T:System.Reflection.MemberTypes value indicating the type of the member — method, constructor, event, and so on. More... | |
abstract string | Name [get] |
Gets the name of the current member. More... | |
abstract Type | DeclaringType [get] |
Gets the class that declares this member. More... | |
abstract Type | ReflectedType [get] |
Gets the class object that was used to obtain this instance of MemberInfo . More... | |
virtual IEnumerable< CustomAttributeData > | CustomAttributes [get] |
Gets a collection that contains this member's custom attributes. More... | |
virtual int | MetadataToken [get] |
Gets a value that identifies a metadata element. More... | |
virtual Module | Module [get] |
Gets the module in which the type that declares the member represented by the current T:System.Reflection.MemberInfo is defined. More... | |
![]() | |
MemberTypes | MemberType [get] |
Provides COM objects with version-independent access to the P:System.Reflection.MemberInfo.MemberType property. More... | |
string | Name [get] |
Provides COM objects with version-independent access to the P:System.Reflection.MemberInfo.Name property. More... | |
Type | DeclaringType [get] |
Provides COM objects with version-independent access to the P:System.Reflection.MemberInfo.DeclaringType property. More... | |
Type | ReflectedType [get] |
Provides COM objects with version-independent access to the P:System.Reflection.MemberInfo.ReflectedType property. More... | |
![]() | |
MemberTypes | MemberType [get] |
Provides COM objects with version-independent access to the P:System.Reflection.FieldInfo.MemberType property. More... | |
string | Name [get] |
Provides COM objects with version-independent access to the P:System.Reflection.MemberInfo.Name property. More... | |
Type | DeclaringType [get] |
Provides COM objects with version-independent access to the P:System.Reflection.MemberInfo.DeclaringType property. More... | |
Type | ReflectedType [get] |
Provides COM objects with version-independent access to the P:System.Reflection.MemberInfo.ReflectedType property. More... | |
Type | FieldType [get] |
Provides COM objects with version-independent access to the P:System.Reflection.FieldInfo.FieldType property. More... | |
RuntimeFieldHandle | FieldHandle [get] |
Provides COM objects with version-independent access to the P:System.Reflection.FieldInfo.FieldHandle property. More... | |
FieldAttributes | Attributes [get] |
Provides COM objects with version-independent access to the P:System.Reflection.FieldInfo.Attributes property. More... | |
bool | IsPublic [get] |
Provides COM objects with version-independent access to the P:System.Reflection.FieldInfo.IsPublic property. More... | |
bool | IsPrivate [get] |
Provides COM objects with version-independent access to the P:System.Reflection.FieldInfo.IsPrivate property. More... | |
bool | IsFamily [get] |
Provides COM objects with version-independent access to the P:System.Reflection.FieldInfo.IsFamily property. More... | |
bool | IsAssembly [get] |
Provides COM objects with version-independent access to the P:System.Reflection.FieldInfo.IsAssembly property. More... | |
bool | IsFamilyAndAssembly [get] |
Provides COM objects with version-independent access to the P:System.Reflection.FieldInfo.IsFamilyAndAssembly property. More... | |
bool | IsFamilyOrAssembly [get] |
Provides COM objects with version-independent access to the P:System.Reflection.FieldInfo.IsFamilyOrAssembly property. More... | |
bool | IsStatic [get] |
Provides COM objects with version-independent access to the P:System.Reflection.FieldInfo.IsStatic property. More... | |
bool | IsInitOnly [get] |
Provides COM objects with version-independent access to the P:System.Reflection.FieldInfo.IsInitOnly property. More... | |
bool | IsLiteral [get] |
Provides COM objects with version-independent access to the P:System.Reflection.FieldInfo.IsLiteral property. More... | |
bool | IsNotSerialized [get] |
Provides COM objects with version-independent access to the P:System.Reflection.FieldInfo.IsNotSerialized property. More... | |
bool | IsSpecialName [get] |
Provides COM objects with version-independent access to the P:System.Reflection.FieldInfo.IsSpecialName property. More... | |
bool | IsPinvokeImpl [get] |
Provides COM objects with version-independent access to the P:System.Reflection.FieldInfo.IsPinvokeImpl property. More... | |
Discovers the attributes of a field and provides access to field metadata.
Definition at line 15 of file FieldInfo.cs.
override bool System.Reflection.FieldInfo.Equals | ( | object | obj | ) |
Returns a value that indicates whether this instance is equal to a specified object.
obj | An object to compare with this instance, or null . |
true
if obj equals the type and value of this instance; otherwise, false
.Implements System.Runtime.InteropServices._FieldInfo.
Definition at line 277 of file FieldInfo.cs.
|
static |
Gets a T:System.Reflection.FieldInfo for the field represented by the specified handle.
handle | A T:System.RuntimeFieldHandle structure that contains the handle to the internal metadata representation of a field. |
T:System.ArgumentException | handle is invalid. |
Definition at line 209 of file FieldInfo.cs.
|
static |
Gets a T:System.Reflection.FieldInfo for the field represented by the specified handle, for the specified generic type.
handle | A T:System.RuntimeFieldHandle structure that contains the handle to the internal metadata representation of a field. |
declaringType | A T:System.RuntimeTypeHandle structure that contains the handle to the generic type that defines the field. |
T:System.ArgumentException | handle is invalid.-or- declaringType is not compatible with handle . For example, declaringType is the runtime type handle of the generic type definition, and handle comes from a constructed type. See Remarks. |
Definition at line 233 of file FieldInfo.cs.
override int System.Reflection.FieldInfo.GetHashCode | ( | ) |
Returns the hash code for this instance.
Implements System.Runtime.InteropServices._FieldInfo.
Definition at line 285 of file FieldInfo.cs.
|
virtual |
Gets an array of types that identify the optional custom modifiers of the field.
Definition at line 299 of file FieldInfo.cs.
|
virtual |
Returns a literal value associated with the field by a compiler.
null
.T:System.InvalidOperationException | The Constant table in unmanaged metadata does not contain a constant value for the current field. |
T:System.FormatException | The type of the value is not one of the types permitted by the Common Language Specification (CLS). See the ECMA Partition II specification Metadata Logical Format: Other Structures, Element Types used in Signatures. |
T:System.NotSupportedException | The constant value for the field is not set. |
Definition at line 341 of file FieldInfo.cs.
|
virtual |
Gets an array of types that identify the required custom modifiers of the property.
Definition at line 292 of file FieldInfo.cs.
|
pure virtual |
When overridden in a derived class, returns the value of a field supported by a given object.
obj | The object whose field value will be returned. |
T:System.Reflection.TargetException | In the .NET for Windows Store apps or the Portable Class Library, catch T:System.Exception instead.The field is non-static and obj is null . |
T:System.NotSupportedException | A field is marked literal, but the field does not have one of the accepted literal types. |
T:System.FieldAccessException | In the .NET for Windows Store apps or the Portable Class Library, catch the base class exception, T:System.MemberAccessException, instead.The caller does not have permission to access this field. |
T:System.ArgumentException | The method is neither declared nor inherited by the class of obj . |
Implements System.Runtime.InteropServices._FieldInfo.
Implemented in System.Reflection.Emit.FieldBuilder.
|
virtual |
Returns the value of a field supported by a given object.
obj | A <see cref="T:System.TypedReference" /> structure that encapsulates a managed pointer to a location and a runtime representation of the type that might be stored at that location. </param>
|
Implements System.Runtime.InteropServices._FieldInfo.
Definition at line 321 of file FieldInfo.cs.
Indicates whether two T:System.Reflection.FieldInfo objects are not equal.
left | The first object to compare. |
right | The second object to compare. |
true
if left is not equal to right ; otherwise, false
.Definition at line 267 of file FieldInfo.cs.
Indicates whether two T:System.Reflection.FieldInfo objects are equal.
left | The first object to compare. |
right | The second object to compare. |
true
if left is equal to right ; otherwise, false
.Definition at line 248 of file FieldInfo.cs.
|
pure virtual |
When overridden in a derived class, sets the value of the field supported by the given object.
obj | The object whose field value will be set. |
value | The value to assign to the field. |
invokeAttr | A field of Binder that specifies the type of binding that is desired (for example, Binder.CreateInstance or Binder.ExactBinding ). |
binder | A set of properties that enables the binding, coercion of argument types, and invocation of members through reflection. If binder is null , then Binder.DefaultBinding is used. |
culture | The software preferences of a particular culture. |
T:System.FieldAccessException | The caller does not have permission to access this field. |
T:System.Reflection.TargetException | The obj parameter is null and the field is an instance field. |
T:System.ArgumentException | The field does not exist on the object.-or- The value parameter cannot be converted and stored in the field. |
Implements System.Runtime.InteropServices._FieldInfo.
Implemented in System.Reflection.Emit.FieldBuilder.
void System.Reflection.FieldInfo.SetValue | ( | object | obj, |
object | value | ||
) |
Sets the value of the field supported by the given object.
obj | The object whose field value will be set. |
value | The value to assign to the field. |
T:System.FieldAccessException | In the .NET for Windows Store apps or the Portable Class Library, catch the base class exception, T:System.MemberAccessException, instead.The caller does not have permission to access this field. |
T:System.Reflection.TargetException | In the .NET for Windows Store apps or the Portable Class Library, catch T:System.Exception instead.The obj parameter is null and the field is an instance field. |
T:System.ArgumentException | The field does not exist on the object.-or- The value parameter cannot be converted and stored in the field. |
Implements System.Runtime.InteropServices._FieldInfo.
Definition at line 368 of file FieldInfo.cs.
|
virtual |
Sets the value of the field supported by the given object.
obj | A T:System.TypedReference structure that encapsulates a managed pointer to a location and a runtime representation of the type that can be stored at that location. |
value | The value to assign to the field. |
T:System.NotSupportedException | The caller requires the Common Language Specification (CLS) alternative, but called this method instead. |
Implements System.Runtime.InteropServices._FieldInfo.
Definition at line 309 of file FieldInfo.cs.
bool System.Reflection.FieldInfo.IsNotSerialized => (Attributes & FieldAttributes.NotSerialized) != FieldAttributes.PrivateScope |
Gets a value indicating whether this field has the NotSerialized
attribute.
true
if the field has the NotSerialized
attribute set; otherwise, false
.Definition at line 168 of file FieldInfo.cs.
bool System.Reflection.FieldInfo.IsPinvokeImpl => (Attributes & FieldAttributes.PinvokeImpl) != FieldAttributes.PrivateScope |
Gets a value indicating whether the corresponding PinvokeImpl
attribute is set in T:System.Reflection.FieldAttributes.
true
if the PinvokeImpl
attribute is set in T:System.Reflection.FieldAttributes; otherwise, false
.Definition at line 186 of file FieldInfo.cs.
virtual bool System.Reflection.FieldInfo.IsSecurityCritical => FieldHandle.IsSecurityCritical() |
Gets a value that indicates whether the current field is security-critical or security-safe-critical at the current trust level.
true
if the current field is security-critical or security-safe-critical at the current trust level; false
if it is transparent. Definition at line 191 of file FieldInfo.cs.
virtual bool System.Reflection.FieldInfo.IsSecuritySafeCritical => FieldHandle.IsSecuritySafeCritical() |
Gets a value that indicates whether the current field is security-safe-critical at the current trust level.
true
if the current field is security-safe-critical at the current trust level; false
if it is security-critical or transparent.Definition at line 196 of file FieldInfo.cs.
virtual bool System.Reflection.FieldInfo.IsSecurityTransparent => FieldHandle.IsSecurityTransparent() |
Gets a value that indicates whether the current field is transparent at the current trust level.
true
if the field is security-transparent at the current trust level; otherwise, false
.Definition at line 201 of file FieldInfo.cs.
override MemberTypes System.Reflection.FieldInfo.MemberType => MemberTypes.Field |
Gets a T:System.Reflection.MemberTypes value indicating that this member is a field.
Definition at line 19 of file FieldInfo.cs.
|
get |
Gets the attributes associated with this field.
FieldAttributes
for this field.Definition at line 43 of file FieldInfo.cs.
|
get |
Gets a RuntimeFieldHandle
, which is a handle to the internal metadata representation of a field.
Definition at line 25 of file FieldInfo.cs.
|
get |
Gets the type of this field object.
Definition at line 34 of file FieldInfo.cs.
|
get |
Gets a value indicating whether the potential visibility of this field is described by F:System.Reflection.FieldAttributes.Assembly; 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.
true
if the visibility of this field is exactly described by F:System.Reflection.FieldAttributes.Assembly; otherwise, false
.Definition at line 92 of file FieldInfo.cs.
|
get |
Gets a value indicating whether the visibility of this field is described by F:System.Reflection.FieldAttributes.Family; that is, the field is visible only within its class and derived classes.
true
if access to this field is exactly described by F:System.Reflection.FieldAttributes.Family; otherwise, false
.Definition at line 79 of file FieldInfo.cs.
|
get |
Gets a value indicating whether the visibility of this field is described by F:System.Reflection.FieldAttributes.FamANDAssem; that is, the field can be accessed from derived classes, but only if they are in the same assembly.
true
if access to this field is exactly described by F:System.Reflection.FieldAttributes.FamANDAssem; otherwise, false
.Definition at line 105 of file FieldInfo.cs.
|
get |
Gets a value indicating whether the potential visibility of this field is described by F:System.Reflection.FieldAttributes.FamORAssem; that is, the field can be accessed by derived classes wherever they are, and by classes in the same assembly.
true
if access to this field is exactly described by F:System.Reflection.FieldAttributes.FamORAssem; otherwise, false
.Definition at line 118 of file FieldInfo.cs.
|
get |
Gets a value indicating whether the field can only be set in the body of the constructor.
true
if the field has the InitOnly
attribute set; otherwise, false
.Definition at line 144 of file FieldInfo.cs.
|
get |
Gets a value indicating whether the value is written at compile time and cannot be changed.
true
if the field has the Literal
attribute set; otherwise, false
.Definition at line 157 of file FieldInfo.cs.
|
get |
Gets a value indicating whether the field is private.
true
if the field is private; otherwise; false
.Definition at line 66 of file FieldInfo.cs.
|
get |
Gets a value indicating whether the field is public.
true
if this field is public; otherwise, false
.Definition at line 53 of file FieldInfo.cs.
|
get |
Gets a value indicating whether the corresponding SpecialName
attribute is set in the T:System.Reflection.FieldAttributes enumerator.
true
if the SpecialName
attribute is set in T:System.Reflection.FieldAttributes; otherwise, false
.Definition at line 175 of file FieldInfo.cs.
|
get |
Gets a value indicating whether the field is static.
true
if this field is static; otherwise, false
.Definition at line 131 of file FieldInfo.cs.