PostSharp SDK 6.10 / / Class Reference / Post­Sharp.​Sdk.​Code­Model Namespace / Generic­Helper Class / Generic­Helper Methods / Generic­Helper.​Get­Canonical­Generic­Instance Method / Generic­Helper.​Get­Canonical­Generic­Instance Method (IGeneric­Method­Definition)

GenericHelper.GetCanonicalGenericInstance Method (IGenericMethodDefinition)

Gets the canonical generic instance of a generic method.

Namespace:  PostSharp.Sdk.CodeModel
Assembly:  PostSharp.Compiler.Engine (in PostSharp.Compiler.Engine.dll) Version: (
public static IMethod GetCanonicalGenericInstance(
	this IGenericMethodDefinition method


Type: PostSharp.Sdk.CodeModel.IGenericMethodDefinition
Method whose canonical generic instance is requested.

Return Value

Type: IMethod
The canonical generic instance of method, or the unmodified method if method is not a generic method definition.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IGenericMethodDefinition. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

The canonical generic instance of a method is a generic instance where the n-th formal generic method argument is mapped to the n-th concrete generic method parameter. If the declaring type is a generic type definition, the canonical generic instance of the method is defined on the canonical generic instance of the declaring type (see GetCanonicalGenericInstance(IGenericTypeDefinition)).

For instance, the canonical generic instance of the type MyType`3::MyMethod is MyType`3<!0,!1,!2>::MyMethod<!0,!1>. if MyMethod has two generic arguments.

See Also