Open sandboxFocus

Class GenericExtensions

Provides extension methods to work with generic declarations.

Inheritance
GenericExtensions
Namespace: Metalama.Framework.Code
Assembly: Metalama.Framework.dll
Syntax
[CompileTime]
public static class GenericExtensions

Methods

Name Description
ForTypeInstance(IConstructor, INamedType)

Returns a representation of the current IConstructor, but for a different generic instance of the declaring type.

ForTypeInstance(IEvent, INamedType)

Returns a representation of the current IEvent, but for a different generic instance of the declaring type.

ForTypeInstance(IField, INamedType)

Returns a representation of the current IField, but for a different generic instance of the declaring type.

ForTypeInstance(IMemberOrNamedType, INamedType)
ForTypeInstance(IMethod, INamedType)

Returns a representation of the current IMethod, but for a different generic instance of the declaring type.

ForTypeInstance(INamedType, INamedType)

Returns a representation of the current nested INamedType, but for a different generic instance of the declaring type.

ForTypeInstance(IProperty, INamedType)

Returns a representation of the current IProperty, but for a different generic instance of the declaring type.

GetBase(IMemberOrNamedType)

Gets the base type of a type or the base member of an overridden member, if any.

GetOriginalDefinition(IConstructor)
GetOriginalDefinition(IDeclaration)
GetOriginalDefinition(IEvent)
GetOriginalDefinition(IMember)
GetOriginalDefinition(IMemberOrNamedType)
GetOriginalDefinition(IMethod)
GetOriginalDefinition(INamedType)
GetOriginalDefinition(IProperty)
IsSelfOrDeclaringTypeGeneric(IMemberOrNamedType)

Returns true if the current declaration, or any the declaring type, is generic.

MakeGenericInstance(IMethod, params IType[])
MakeGenericInstance(IMethod, IReadOnlyList<Type>)
MakeGenericInstance(IMethod, params Type[])
MakeGenericInstance(INamedType, params IType[])
MakeGenericInstance(INamedType, IReadOnlyList<Type>)
MakeGenericInstance(INamedType, params Type[])
WithTypeArguments(IMethod, params IType[])
WithTypeArguments(IMethod, IReadOnlyList<IType>)
WithTypeArguments(IMethod, IReadOnlyList<Type>, IReadOnlyList<Type>)
WithTypeArguments(IMethod, params Type[])
WithTypeArguments(IMethod, Type[], Type[])
WithTypeArguments(INamedType, params IType[])

Constructs a generic instance of an INamedType, with type arguments given as IType.

WithTypeArguments(INamedType, IReadOnlyList<IType>)
WithTypeArguments(INamedType, IReadOnlyList<Type>)
WithTypeArguments(INamedType, params Type[])