Show / Hide Table of Contents

Class Type<T>.Method

Provides access to methods declared in type T.

Inheritance
Object
Type<T>.Method
Inherited Members
Object.Equals(Object)
Object.Equals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Object.ReferenceEquals(Object, Object)
Object.ToString()
Namespace: DotNext.Reflection
Assembly: DotNext.Reflection.dll
Syntax
public static class Method

Methods

| Improve this Doc View Source

Get(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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX