Class Reflector
Provides access to fast reflection routines.
Namespace: DotNext.Reflection
Assembly: DotNext.Reflection.dll
Syntax
public static class Reflector : object
Methods
| Improve this Doc View SourceMemberOf<M>(Expression<Action>)
Extracts member metadata from expression tree.
Declaration
public static M MemberOf<M>(Expression<Action> exprTree)
where M : MemberInfo
Parameters
| Type | Name | Description |
|---|---|---|
| Expression<Action> | exprTree | Expression tree. |
Returns
| Type | Description |
|---|---|
| M | Reflected member; or null, if lambda expression doesn't reference a member. |
Type Parameters
| Name | Description |
|---|---|
| M | Type of member to reflect. |
Unreflect<D>(ConstructorInfo)
Unreflects constructor to its typed and callable representation.
Declaration
public static Constructor<D> Unreflect<D>(this ConstructorInfo ctor)
where D : MulticastDelegate
Parameters
| Type | Name | Description |
|---|---|---|
| ConstructorInfo | ctor | Constructor to unreflect. |
Returns
| Type | Description |
|---|---|
| Constructor<D> | Unreflected constructor. |
Type Parameters
| Name | Description |
|---|---|
| D | A delegate representing signature of constructor. |
Unreflect<V>(FieldInfo)
Obtains managed pointer to the static field.
Declaration
public static V Unreflect<V>(this FieldInfo field)
Parameters
| Type | Name | Description |
|---|---|---|
| FieldInfo | field | The field to unreflect. |
Returns
| Type | Description |
|---|---|
| V | The managed pointer to the field. |
Type Parameters
| Name | Description |
|---|---|
| V | The field type. |
Unreflect<D>(MethodInfo)
Unreflects method to its typed and callable representation.
Declaration
public static Method<D> Unreflect<D>(this MethodInfo method)
where D : MulticastDelegate
Parameters
| Type | Name | Description |
|---|---|---|
| MethodInfo | method | A method to unreflect. |
Returns
| Type | Description |
|---|---|
| Method<D> | Unreflected method. |
Type Parameters
| Name | Description |
|---|---|
| D | A delegate representing signature of method. |
Unreflect<T, V>(FieldInfo, T)
Obtains managed pointer to the instance field.
Declaration
public static V Unreflect<T, V>(this FieldInfo field, in T instance)
Parameters
| Type | Name | Description |
|---|---|---|
| FieldInfo | field | The field to unreflect. |
| T | instance | The object that contains instance field. |
Returns
| Type | Description |
|---|---|
| V | The managed pointer to the field. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the object that declares instance field. |
| V | The field type. |