MetalamaAPI documentationAspect APIMetalama.​Framework.​CodeIType
Open sandboxFocus

IType Interface

Represents a constructed type, for instance an array, a generic type instance, a pointer. A class, struct, enum or delegate are represented as an INamedType, which derive from IType.

Namespace: Metalama.Framework.Code
Assembly: Metalama.Framework.dll
Syntax
[CompileTime]
public interface IType : ICompilationElement, IDisplayable
Remarks

The IType interface implements System.IEquatable<>. The implementation uses the Default comparer. To use a different comparer, choose a different comparer from IDeclaration.Compilation.Comparers. You can also use Equals(IType, TypeComparison) and specify a TypeComparison.

Properties

Name Description
IsNullable

Gets the nullability of the type, or null if the type is a reference type but its nullability has not been analyzed or specified. This property returns false for normal value types and true for the System.Nullable<> type. Note that in case of nullable value types, the current type represents the System.Nullable<> type itself, and the inner value type is exposed as UnderlyingType.

IsReferenceType

Gets a value indicating whether the type is a reference type. If the type is a generic parameter without a struct, class or similar constraint, this property evaluates to null.

SpecialType

Gets the SpecialType enumeration value for the current type. Provides a fast to determine whether the current type is of a well-known type.

TypeKind

Gets the kind of type.

Methods

Name Description
Equals(IType, TypeComparison)
Equals(SpecialType)

Determines whether the current type is equal to a well-known special type.

ToType()

Gets a reflection System.Type that represents the current type at run time.

Extension Methods

TypeExtensions.Is(IType, IType, ConversionKind, TypeComparison)
TypeExtensions.Is(IType, Type, ConversionKind, TypeComparison)
TypeExtensions.Is(IType, SpecialType, ConversionKind)
TypeExtensions.DefaultValue(IType)
TypeExtensions.GetAsyncInfo(IType)
TypeExtensions.ToSerializableId(IType)
TypeExtensions.ToTypeOfExpression(IType)
TypeFactory.MakeArrayType(IType, Int32)
TypeFactory.MakePointerType(IType)
TypeFactory.ToNullableType(IType)
TypeFactory.ToNonNullableType(IType)
SymbolExtensions.GetSymbol(IType)

See Also