Class Field<T, TValue>
Provides typed access to instance field declared in type T
.
Implements
Inherited Members
Namespace: DotNext.Reflection
Assembly: DotNext.Reflection.dll
Syntax
public sealed class Field<T, TValue> : FieldBase<TValue>, IEquatable<FieldInfo>, IField<T, TValue>, IField, IMember<FieldInfo>, ICustomAttributeProvider
Type Parameters
Name | Description |
---|---|
T | Declaring type. |
TValue | Type of field value. |
Properties
| Improve this Doc View SourceItem[T]
Gets or sets instance field value.
Declaration
public TValue this[in T this] { get; }
Parameters
Type | Name | Description |
---|---|---|
T | this |
|
Property Value
Type | Description |
---|---|
TValue |
Methods
| 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
GetValue(Object, out TValue)
Returns the value of a field supported by a given object.
Declaration
public override 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. |
Overrides
SetValue(Object, TValue)
Sets the value of the field supported by the given object.
Declaration
public override 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. |
Overrides
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
Operators
| Improve this Doc View SourceImplicit(Field<T, TValue> to MemberGetter<T, TValue>)
Obtains field getter in the form of the delegate instance.
Declaration
public static implicit operator MemberGetter<T, TValue>(Field<T, TValue> field)
Parameters
Type | Name | Description |
---|---|---|
Field<T, TValue> | field | The reflected field. |
Returns
Type | Description |
---|---|
MemberGetter<T, TValue> |
Implicit(Field<T, TValue> to MemberSetter<T, TValue>)
Obtains field setter in the form of the delegate instance.
Declaration
public static implicit operator MemberSetter<T, TValue>(Field<T, TValue> field)
Parameters
Type | Name | Description |
---|---|---|
Field<T, TValue> | field | The reflected field. |
Returns
Type | Description |
---|---|
MemberSetter<T, TValue> |