Class FieldBase<TValue>
Represents reflected field.
Inherited Members
Namespace: DotNext.Reflection
Assembly: DotNext.Reflection.dll
Syntax
public abstract class FieldBase<TValue> : FieldInfo, IField, IMember<FieldInfo>, ICustomAttributeProvider, IEquatable<FieldInfo>
Type Parameters
Name | Description |
---|---|
TValue | Type of field value. |
Properties
| Improve this Doc View SourceAttributes
Gets the attributes associated with this field.
Declaration
public override sealed FieldAttributes Attributes { get; }
Property Value
Type | Description |
---|---|
FieldAttributes |
Overrides
| Improve this Doc View SourceCustomAttributes
Gets a collection that contains this member's custom attributes.
Declaration
public override sealed IEnumerable<CustomAttributeData> CustomAttributes { get; }
Property Value
Type | Description |
---|---|
IEnumerable<CustomAttributeData> |
Overrides
| Improve this Doc View SourceDeclaringType
Gets the class that declares this field.
Declaration
public override sealed Type DeclaringType { get; }
Property Value
Type | Description |
---|---|
Type |
Overrides
| Improve this Doc View SourceFieldHandle
Gets a handle to the internal metadata representation of this field.
Declaration
public override sealed RuntimeFieldHandle FieldHandle { get; }
Property Value
Type | Description |
---|---|
RuntimeFieldHandle |
Overrides
| Improve this Doc View SourceFieldType
Gets type of this field.
Declaration
public override sealed Type FieldType { get; }
Property Value
Type | Description |
---|---|
Type |
Overrides
| Improve this Doc View SourceIsReadOnly
Determines whether this field is read-only and cannot be modified.
Declaration
public bool IsReadOnly { get; }
Property Value
Type | Description |
---|---|
Boolean |
IsSecurityCritical
Gets a value that indicates whether the field is security-critical or security-safe-critical at the current trust level, and therefore can perform critical operations.
Declaration
public override sealed bool IsSecurityCritical { get; }
Property Value
Type | Description |
---|---|
Boolean |
Overrides
| Improve this Doc View SourceIsSecuritySafeCritical
Gets a value that indicates whether the field is security-safe-critical at the current trust level; that is, whether it can perform critical operations and can be accessed by transparent code.
Declaration
public override sealed bool IsSecuritySafeCritical { get; }
Property Value
Type | Description |
---|---|
Boolean |
Overrides
| Improve this Doc View SourceIsSecurityTransparent
Gets a value that indicates whether the current field is transparent at the current trust level, and therefore cannot perform critical operations.
Declaration
public override sealed bool IsSecurityTransparent { get; }
Property Value
Type | Description |
---|---|
Boolean |
Overrides
| Improve this Doc View SourceMemberType
Always returns Field.
Declaration
public override sealed MemberTypes MemberType { get; }
Property Value
Type | Description |
---|---|
MemberTypes |
Overrides
| Improve this Doc View SourceMetadataToken
Gets a value that identifies a metadata element.
Declaration
public override sealed int MetadataToken { get; }
Property Value
Type | Description |
---|---|
Int32 |
Overrides
| Improve this Doc View SourceModule
Gets the module in which the type that declares the field represented by the current instance is defined.
Declaration
public override sealed Module Module { get; }
Property Value
Type | Description |
---|---|
Module |
Overrides
| Improve this Doc View SourceName
Gets name of the field.
Declaration
public override sealed string Name { get; }
Property Value
Type | Description |
---|---|
String |
Overrides
| Improve this Doc View SourceReflectedType
Gets the class object that was used to obtain this instance.
Declaration
public override sealed Type ReflectedType { get; }
Property Value
Type | Description |
---|---|
Type |
Overrides
Methods
| Improve this Doc View SourceEquals(Object)
Determines whether this field is equal to the given field.
Declaration
public override sealed bool Equals(object other)
Parameters
Type | Name | Description |
---|---|---|
Object | other | Other field to compare. |
Returns
Type | Description |
---|---|
Boolean | true if this object reflects the same field as the specified object; otherwise, false. |
Overrides
| Improve this Doc View SourceEquals(FieldInfo)
Determines whether this field is equal to the given field.
Declaration
public bool Equals(FieldInfo other)
Parameters
Type | Name | Description |
---|---|---|
FieldInfo | other | Other field to compare. |
Returns
Type | Description |
---|---|
Boolean | true if this object reflects the same field as the specified object; otherwise, false. |
GetCustomAttributes(Boolean)
Returns an array of all custom attributes applied to this field.
Declaration
public override sealed object[] GetCustomAttributes(bool inherit)
Parameters
Type | Name | Description |
---|---|---|
Boolean | inherit | true to search this member's inheritance chain to find the attributes; otherwise, false. |
Returns
Type | Description |
---|---|
Object[] | An array that contains all the custom attributes applied to this field. |
Overrides
| Improve this Doc View SourceGetCustomAttributes(Type, Boolean)
Returns an array of all custom attributes applied to this field.
Declaration
public override sealed object[] GetCustomAttributes(Type attributeType, bool inherit)
Parameters
Type | Name | Description |
---|---|---|
Type | attributeType | The type of attribute to search for. Only attributes that are assignable to this type are returned. |
Boolean | inherit | true to search this member's inheritance chain to find the attributes; otherwise, false. |
Returns
Type | Description |
---|---|
Object[] | An array that contains all the custom attributes applied to this field. |
Overrides
| Improve this Doc View SourceGetCustomAttributesData()
Declaration
public override sealed IList<CustomAttributeData> GetCustomAttributesData()
Returns
Type | Description |
---|---|
IList<CustomAttributeData> |
Overrides
| Improve this Doc View SourceGetHashCode()
Computes hash code uniquely identifies the reflected field.
Declaration
public override sealed int GetHashCode()
Returns
Type | Description |
---|---|
Int32 | The hash code of the field. |
Overrides
| Improve this Doc View SourceGetOptionalCustomModifiers()
Gets an array of types that identify the optional custom modifiers of the field.
Declaration
public override sealed Type[] GetOptionalCustomModifiers()
Returns
Type | Description |
---|---|
Type[] | An array of objects that identify the optional custom modifiers of the current field. |
Overrides
| Improve this Doc View SourceGetRawConstantValue()
Returns a literal value associated with the field by a compiler.
Declaration
public override sealed object GetRawConstantValue()
Returns
Type | Description |
---|---|
Object | 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. |
Overrides
| Improve this Doc View SourceGetRequiredCustomModifiers()
Gets an array of types that identify the required custom modifiers of the field.
Declaration
public override sealed Type[] GetRequiredCustomModifiers()
Returns
Type | Description |
---|---|
Type[] | An array of objects that identify the required custom modifiers of the current field. |
Overrides
| Improve this Doc View SourceGetValue(Object)
Returns the value of a field supported by a given object.
Declaration
public override object GetValue(object obj)
Parameters
Type | Name | Description |
---|---|---|
Object | obj | The object whose field value will be returned. |
Returns
Type | Description |
---|---|
Object | An object containing the value of the field reflected by this instance. |
Overrides
| Improve this Doc View SourceGetValue(Object, out TValue)
Returns the value of a field supported by a given object.
Declaration
public abstract bool GetValue(object obj, out TValue value)
Parameters
Type | Name | Description |
---|---|---|
Object | obj | The object whose field value will be returned. |
TValue | value | An object containing the value of the field reflected by this instance. |
Returns
Type | Description |
---|---|
Boolean | true, if field value is obtained successfully; otherwise, false. |
GetValueDirect(TypedReference)
Returns the value of a field supported by a given object.
Declaration
[CLSCompliant(false)]
public override sealed object GetValueDirect(TypedReference obj)
Parameters
Type | Name | Description |
---|---|---|
TypedReference | obj | A managed pointer to a location and a runtime representation of the type that might be stored at that location. |
Returns
Type | Description |
---|---|
Object | An object containing the value of the field reflected by this instance. |
Overrides
| Improve this Doc View SourceIsDefined(Type, Boolean)
Determines whether one or more attributes of the specified type or of its derived types is applied to this field.
Declaration
public override sealed bool IsDefined(Type attributeType, bool inherit)
Parameters
Type | Name | Description |
---|---|---|
Type | attributeType | The type of custom attribute to search for. The search includes derived types. |
Boolean | inherit | true to search this member's inheritance chain to find the attributes; otherwise, false. |
Returns
Type | Description |
---|---|
Boolean | true if one or more instances of |
Overrides
| Improve this Doc View SourceSetValue(Object, TValue)
Sets the value of the field supported by the given object.
Declaration
public abstract bool SetValue(object obj, TValue value)
Parameters
Type | Name | Description |
---|---|---|
Object | obj | The object whose field value will be set. |
TValue | value | The value to assign to the field. |
Returns
Type | Description |
---|---|
Boolean | true, if field value is modified successfully; otherwise, false. |
SetValue(Object, Object, BindingFlags, Binder, CultureInfo)
Sets the value of the field supported by the given object.
Declaration
public override void SetValue(object obj, object value, BindingFlags invokeAttr, Binder binder, CultureInfo culture)
Parameters
Type | Name | Description |
---|---|---|
Object | obj | The object whose field value will be returned. |
Object | value | The value to assign to the field. |
BindingFlags | invokeAttr | The type of binding that is desired. |
Binder | binder | A set of properties that enables the binding, coercion of argument types, and invocation of members through reflection. |
CultureInfo | culture | The software preferences of a particular culture. |
Overrides
| Improve this Doc View SourceSetValueDirect(TypedReference, Object)
Sets the value of the field supported by the given object.
Declaration
[CLSCompliant(false)]
public override sealed void SetValueDirect(TypedReference obj, object value)
Parameters
Type | Name | Description |
---|---|---|
TypedReference | obj | A managed pointer to a location and a runtime representation of the type that might be stored at that location. |
Object | value | The value to assign to the field. |
Overrides
| Improve this Doc View SourceToString()
Returns textual representation of this field.
Declaration
public override sealed string ToString()
Returns
Type | Description |
---|---|
String | The textual representation of this field. |
Overrides
Explicit Interface Implementations
| Improve this Doc View SourceIMember<FieldInfo>.RuntimeMember
Declaration
FieldInfo IMember<FieldInfo>.RuntimeMember { get; }
Returns
Type | Description |
---|---|
FieldInfo |