Class Type<T>.Field<TValue>
Provides typed access to instance field declared in type T.
Inherited Members
Namespace: DotNext.Reflection
Assembly: DotNext.Reflection.dll
Syntax
public static class Field<TValue>
Type Parameters
| Name | Description |
|---|---|
| TValue | Type of field value. |
Methods
| Improve this Doc View SourceGet(String, Boolean)
Gets instance field.
Declaration
public static Field<T, TValue> Get(string fieldName, bool nonPublic = false)
Parameters
| Type | Name | Description |
|---|---|---|
| String | fieldName | Name of field. |
| Boolean | nonPublic | true to reflect non-public field. |
Returns
| Type | Description |
|---|---|
| Field<T, TValue> | Instance field; or null, if field doesn't exist. |
GetStatic(String, Boolean)
Gets static field.
Declaration
public static Field<TValue> GetStatic(string fieldName, bool nonPublic = false)
Parameters
| Type | Name | Description |
|---|---|---|
| String | fieldName | Name of field. |
| Boolean | nonPublic | true to reflect non-public field. |
Returns
| Type | Description |
|---|---|
| Field<TValue> | Instance field; or null, if field doesn't exist. |
Require(String, Boolean)
Gets instance field.
Declaration
public static Field<T, TValue> Require(string fieldName, bool nonPublic = false)
Parameters
| Type | Name | Description |
|---|---|---|
| String | fieldName | Name of field. |
| Boolean | nonPublic | true to reflect non-public field. |
Returns
| Type | Description |
|---|---|
| Field<T, TValue> | Instance field. |
Exceptions
| Type | Condition |
|---|---|
| MissingEventException | Field doesn't exist. |
RequireStatic(String, Boolean)
Gets static field.
Declaration
public static Field<TValue> RequireStatic(string fieldName, bool nonPublic = false)
Parameters
| Type | Name | Description |
|---|---|---|
| String | fieldName | Name of field. |
| Boolean | nonPublic | true to reflect non-public field. |
Returns
| Type | Description |
|---|---|
| Field<TValue> | Instance field. |
Exceptions
| Type | Condition |
|---|---|
| MissingEventException | Field doesn't exist. |