Class Type<T>.Method
Provides access to methods declared in type T
.
Inherited Members
Namespace: DotNext.Reflection
Assembly: DotNext.Reflection.dll
Syntax
public static class Method
Methods
| Improve this Doc View SourceGet(String, Boolean)
Reflects instance parameterless method without return type as delegate type Action<T>.
Declaration
public static Method<Action<T>> Get(string methodName, bool nonPublic = false)
Parameters
Type | Name | Description |
---|---|---|
String | methodName | The name of the method. |
Boolean | nonPublic | true to reflect non-public method. |
Returns
Type | Description |
---|---|
Method<Action<T>> | The reflected method; otherwise, null if method doesn't exist. |
Get<TSignature>(String, MethodLookup, Boolean)
Reflects class method.
Declaration
public static Method<TSignature> Get<TSignature>(string methodName, MethodLookup methodType, bool nonPublic = false)
where TSignature : MulticastDelegate
Parameters
Type | Name | Description |
---|---|---|
String | methodName | The name of the method. |
MethodLookup | methodType | The type of the method to be resolved. |
Boolean | nonPublic | true to reflect non-public method. |
Returns
Type | Description |
---|---|
Method<TSignature> | The reflected method; otherwise, null if method doesn't exist. |
Type Parameters
Name | Description |
---|---|
TSignature | The delegate describing signature of the requested method. |
Remarks
This method supports special types of delegates: Function<T, TArgs, TResult> or Procedure<T, TArgs> for instance methods, Function<TArgs, TResult> or Procedure<TArgs> for static methods. The value returned by this method is cached by the given delegate type and method name. Two calls of this method with the same arguments will return the same object.
Get<TResult>(String, Boolean)
Reflects instance parameterless method which as delegate type Func<T,TResult>.
Declaration
public static Method<Func<T, TResult>> Get<TResult>(string methodName, bool nonPublic = false)
Parameters
Type | Name | Description |
---|---|---|
String | methodName | The name of the method. |
Boolean | nonPublic | true to reflect non-public method. |
Returns
Type | Description |
---|---|
Method<Func<T, TResult>> | The reflected method; otherwise, null if method doesn't exist. |
Type Parameters
Name | Description |
---|---|
TResult | The method return type. |
GetStatic(String, Boolean)
Reflects static parameterless method without return type as delegate type Action.
Declaration
public static Method<Action> GetStatic(string methodName, bool nonPublic = false)
Parameters
Type | Name | Description |
---|---|---|
String | methodName | The name of the method. |
Boolean | nonPublic | true to reflect non-public method. |
Returns
Type | Description |
---|---|
Method<Action> | The reflected method; otherwise, null if method doesn't exist. |
GetStatic<TResult>(String, Boolean)
Reflects static parameterless method which as delegate type Func<TResult>.
Declaration
public static Method<Func<TResult>> GetStatic<TResult>(string methodName, bool nonPublic = false)
Parameters
Type | Name | Description |
---|---|---|
String | methodName | The name of the method. |
Boolean | nonPublic | true to reflect non-public method. |
Returns
Type | Description |
---|---|
Method<Func<TResult>> | The reflected method; otherwise, null if method doesn't exist. |
Type Parameters
Name | Description |
---|---|
TResult | The method return type. |
Require(String, Boolean)
Reflects instance parameterless method without return type as delegate type Action<T>.
Declaration
public static Method<Action<T>> Require(string methodName, bool nonPublic = false)
Parameters
Type | Name | Description |
---|---|---|
String | methodName | The name of the method. |
Boolean | nonPublic | true to reflect non-public method. |
Returns
Type | Description |
---|---|
Method<Action<T>> | The reflected method. |
Exceptions
Type | Condition |
---|---|
MissingMethodException | The requested method doesn't exist. |
Require<TSignature>(String, MethodLookup, Boolean)
Reflects class method.
Declaration
public static Method<TSignature> Require<TSignature>(string methodName, MethodLookup methodType, bool nonPublic = false)
where TSignature : MulticastDelegate
Parameters
Type | Name | Description |
---|---|---|
String | methodName | The name of the method. |
MethodLookup | methodType | The type of the method to be resolved. |
Boolean | nonPublic | true to reflect non-public method. |
Returns
Type | Description |
---|---|
Method<TSignature> | The reflected method. |
Type Parameters
Name | Description |
---|---|
TSignature | The delegate describing signature of the requested method. |
Remarks
This method supports special types of delegates: Function<T, TArgs, TResult> or Procedure<T, TArgs> for instance methods, Function<TArgs, TResult> or Procedure<TArgs> for static methods. The value returned by this method is cached by the given delegate type and method name. Two calls of this method with the same arguments will return the same object.
Exceptions
Type | Condition |
---|---|
MissingMethodException | The requested method doesn't exist. |
Require<TResult>(String, Boolean)
Reflects instance parameterless method which as delegate type Func<T,TResult>.
Declaration
public static Method<Func<T, TResult>> Require<TResult>(string methodName, bool nonPublic = false)
Parameters
Type | Name | Description |
---|---|---|
String | methodName | The name of the method. |
Boolean | nonPublic | true to reflect non-public method. |
Returns
Type | Description |
---|---|
Method<Func<T, TResult>> | The reflected method. |
Type Parameters
Name | Description |
---|---|
TResult | The method return type. |
Exceptions
Type | Condition |
---|---|
MissingMethodException | The requested method doesn't exist. |
RequireStatic(String, Boolean)
Reflects static parameterless method without return type as delegate type Action.
Declaration
public static Method<Action> RequireStatic(string methodName, bool nonPublic = false)
Parameters
Type | Name | Description |
---|---|---|
String | methodName | The name of the method. |
Boolean | nonPublic | true to reflect non-public method. |
Returns
Type | Description |
---|---|
Method<Action> | The reflected method. |
Exceptions
Type | Condition |
---|---|
MissingMethodException | The requested method doesn't exist. |
RequireStatic<TResult>(String, Boolean)
Reflects static parameterless method which as delegate type Func<TResult>.
Declaration
public static Method<Func<TResult>> RequireStatic<TResult>(string methodName, bool nonPublic = false)
Parameters
Type | Name | Description |
---|---|---|
String | methodName | The name of the method. |
Boolean | nonPublic | true to reflect non-public method. |
Returns
Type | Description |
---|---|
Method<Func<TResult>> | The reflected method. |
Type Parameters
Name | Description |
---|---|
TResult | The method return type. |
Exceptions
Type | Condition |
---|---|
MissingMethodException | The requested method doesn't exist. |