Open sandboxFocus

Interface IGeneric

An interface, common to INamedType and IMethod, that represents a generic declaration, i.e. a declaration with type parameters.

Namespace: Metalama.Framework.Code
Assembly: Metalama.Framework.dll
Syntax
public interface IGeneric : IMemberOrNamedType, INamedDeclaration, IDeclaration, IDisplayable, IDiagnosticLocation, ICompilationElement, IMeasurable, IEquatable<IDeclaration>
Remarks

In Metalama, and unlike System.Reflection, generic types and methods are always fully bound. In generic declarations, such as in (typeof(List<>), type parameters are bound to themselves, i.e. the content of the TypeArguments and TypeParameters properties are identical.

Properties

Name Description
IsCanonicalGenericInstance

Gets a value indicating whether all type parameters are bound to themselves, i.e. if the content of TypeArguments and TypeParameters are equal. This property returns true if the current declaration has no generic argument. For generic methods, this property returns false if the declaring type is generic but is not a canonical generic instance.

IsGeneric

Gets a value indicating whether this member has type parameters, regardless the fact that the containing type, if any, is generic.

TypeArguments

Gets the generic type arguments of the current type or method, which are the type values applied to the TypeParameters of the current type. The number of items in this list is always the same as in TypeParameters.

TypeParameters

Gets the generic parameters of the current type or method.

Extension Methods

See Also