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

WithTypeArguments(IMethod, params IType[])

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

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

Constructs a generic instance of an IMethod, with type arguments given as reflection 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<Type>)
WithTypeArguments(INamedType, params Type[])

Constructs a generic instance of an INamedType, with type arguments given a reflection Type.