Class MethodInfoExtensions
Contains extensions for the MethodInfo class.
Inherited Members
Namespace: TheXDS.MCART.Types.Extensions
Assembly: MCART.dll
Syntax
public static class MethodInfoExtensions
Methods
| Edit this page View SourceIsOverride(MethodInfo)
Determines if the method overrides a base definition.
Declaration
public static bool IsOverride(this MethodInfo method)
Parameters
Type | Name | Description |
---|---|---|
MethodInfo | method |
Returns
Type | Description |
---|---|
bool | true if the method overrides a base definition, false otherwise. |
IsSignatureCompatible(MethodInfo, Type)
Checks that the signature of a method is compatible with the specified delegate.
Declaration
public static bool IsSignatureCompatible(this MethodInfo staticMethodInfo, Type @delegate)
Parameters
Type | Name | Description |
---|---|---|
MethodInfo | staticMethodInfo | MethodInfo to check. |
Type | delegate |
Returns
Type | Description |
---|---|
bool | true if the method is compatible with the signature of the specified delegate, false otherwise. |
IsSignatureCompatible<T>(MethodInfo)
Checks that the signature of a method is compatible with the delegate specified.
Declaration
public static bool IsSignatureCompatible<T>(this MethodInfo staticMethodInfo) where T : Delegate
Parameters
Type | Name | Description |
---|---|---|
MethodInfo | staticMethodInfo | MethodInfo to check. |
Returns
Type | Description |
---|---|
bool | true if the method is compatible with the signature of the specified delegate, false otherwise. |
Type Parameters
Name | Description |
---|---|
T | Type of the Delegate to check. |
IsVoid(MethodInfo)
Gets a value that determines if the method does not return values (if it is void).
Declaration
public static bool IsVoid(this MethodInfo m)
Parameters
Type | Name | Description |
---|---|---|
MethodInfo | m | Method to check. |
Returns
Type | Description |
---|---|
bool |
ToDelegate<T>(MethodInfo, object?)
Creates a delegate of the specified type from the method.
Declaration
public static T? ToDelegate<T>(this MethodInfo m, object? targetInstance = null) where T : notnull, Delegate
Parameters
Type | Name | Description |
---|---|---|
MethodInfo | m | Method from which to obtain a delegate. |
object | targetInstance | Target instance to which to link the generated delegate, or null to generate a static method delegate. |
Returns
Type | Description |
---|---|
T | A delegate of the specified type from the method, or null if the conversion is not possible. |
Type Parameters
Name | Description |
---|---|
T | Type of delegate to obtain. |