Class Type<T>.Field<V>
Provides typed access to instance field declared in type T
.
Namespace: DotNext.Reflection
Assembly: DotNext.Reflection.dll
Syntax
public static class Field<V> : object
Type Parameters
Name | Description |
---|---|
V | Type of field value. |
Methods
| Improve this Doc View SourceGet(String, Boolean)
Gets instance field.
Declaration
public static Field<T, V> 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, V> | Instance field; or null, if field doesn't exist. |
GetStatic(String, Boolean)
Gets static field.
Declaration
public static Field<V> 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<V> | Instance field; or null, if field doesn't exist. |
Require(String, Boolean)
Gets instance field.
Declaration
public static Field<T, V> 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, V> | Instance field. |
Exceptions
Type | Condition |
---|---|
MissingEventException | Field doesn't exist. |
RequireStatic(String, Boolean)
Gets static field.
Declaration
public static Field<V> 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<V> | Instance field. |
Exceptions
Type | Condition |
---|---|
MissingEventException | Field doesn't exist. |