IMemberAdapterRepository.GetMethodMetadata Method

Namespace
Kampute.DocToolkit.Metadata
Assembly
  • Kampute.DocToolkit.dll
IMemberAdapterRepository.GetMethodMetadata(MethodInfo, bool)Gets the method metadata for the specified method within the assembly.
IMemberAdapterRepository.GetMethodMetadata<T>(MethodInfo)Gets the method metadata for the specified method within the assembly, with a specific return type.

IMemberAdapterRepository.GetMethodMetadata(MethodInfo, bool)

Gets the method metadata for the specified method within the assembly.
IMethodBase GetMethodMetadata(MethodInfo methodInfo, bool asDeclared = false)

Parameters

methodInfo MethodInfo
The reflection method to get metadata for.
asDeclared bool optional
Indicates whether to retrieve extension methods in their declared form rather than their usage form.

Returns

IMethodBase
A metadata representation of the specified method.

Exceptions

ArgumentNullException
Thrown when methodInfo is null.
ArgumentException
Thrown when methodInfo does not belong to the assembly.

Remarks

When asDeclared is false (the default), extension methods are detected and resolved to reflect their usage form rather than their declared form. Otherwise, the metadata is retrieved as declared, without extension method detection and resolution.

Based on the nature of the provided methodInfo, the returned metadata may represent different method types:

  • Regular or Extension MethodThe returned metadata is an instance of IMethod.
  • Operator OverloadThe returned metadata is an instance of IOperator.

IMemberAdapterRepository.GetMethodMetadata<T>(MethodInfo)

Gets the method metadata for the specified method within the assembly, with a specific return type.
T GetMethodMetadata<T>(MethodInfo methodInfo)
	where T : IMethodBase
This method has a default implementation in the interface.

Type Parameters

T
The specific type of method metadata to retrieve.

Parameters

methodInfo MethodInfo
The reflection method to get metadata for.

Returns

T
A metadata representation of the specified method.

Exceptions

ArgumentNullException
Thrown when methodInfo is null.
ArgumentException
Thrown when methodInfo does not belong to the assembly.
InvalidCastException
Thrown when the retrieved method metadata cannot be cast to T.

Remarks

Unlike IMemberAdapterRepository.GetMethodMetadata(MethodInfo, bool), this method always retrieves the method metadata in its resolved form, meaning that extension methods are detected and resolved to reflect their usage form rather than their declared form.