Open sandboxFocus
  • TOC

Metalama Documentation

Getting started

Video tutorials

Conceptual documentation

Commented examples

API documentation

Aspect API

Metalama.​Framework.​Advising

Metalama.​Framework.​Aspects

Metalama.​Framework.​Code

Accessibility

Accessibility­Extensions

Async­Info

Attribute­Extensions

Code­Display­Context

Code­Display­Format

Compilation­Extensions

Constructor­Collection­Extensions

Constructor­Initializer­Kind

Conversion­Kind

Declaration­Enhancements<T>

Declaration­Extensions

Declaration­Kind

Declaration­Origin­Kind

Derived­Types­Options

Enumerable­Kind

Execution­Scope

Generic­Extensions

IAnnotation

IAnnotation<T>

IAspect­Declaration­Origin

IAssembly

IAssembly­Identity

IAttribute

IAttribute­Data

ICompilation

ICompilation­Element

IConstructor

IDeclaration

IDeclaration­Cache

IDeclaration­Factory

IDeclaration­Origin

IDisplayable

IEvent

IExpression

IField

IField­Or­Property

IField­Or­Property­Or­Indexer

IGeneric

IGeneric­Context

IHas­Accessors

IHas­Parameters

IHas­Type

IIndexer

IManaged­Resource

IMember

IMember­Or­Named­Type

IMethod

IMethod­Base

INamed­Declaration

INamed­Type

INamespace

INamespace­Or­Named­Type

IObject­Creation­Expression

IParameter

IProperty

IProperty­Or­Indexer

IRef

IRef<T>

ISource­Expression

Iterator­Info

IType

IType­Parameter

Member­Extensions

Method­Collection­Extensions

Method­Extensions

Method­Kind

Named­Type­Extensions

Namespace­Extensions

Operator­Category

Operator­Kind

Operator­Kind­Extensions

Ref­Comparison

Ref­Extensions

Ref­Kind

Ref­Kind­Extensions

Reflection­Extensions

Serializable­Declaration­Id

Serializable­Type­Id

Source­Reference

Source­Span

Special­Type

Typed­Constant

Type­Extensions

Type­Factory

Type­Kind

Type­Kind­Constraint

Type­Parameter­Kind

Variance­Kind

Writeability

Metalama.​Framework.​Code.​Collections

Metalama.​Framework.​Code.​Comparers

Metalama.​Framework.​Code.​Declaration­Builders

Metalama.​Framework.​Code.​Invokers

Metalama.​Framework.​Code.​Syntax­Builders

Metalama.​Framework.​Code.​Types

Metalama.​Framework.​Code­Fixes

Metalama.​Framework.​Diagnostics

Metalama.​Framework.​Eligibility

Metalama.​Framework.​Fabrics

Metalama.​Framework.​Metrics

Metalama.​Framework.​Options

Metalama.​Framework.​Project

Metalama.​Framework.​Run­Time

Metalama.​Framework.​Serialization

Metalama.​Framework.​Services

Metalama.​Framework.​Utilities

Metalama.​Framework.​Validation

Extensions API

Patterns API

Flashtrace API

Introspection API

Advanced API

Post­Sharp API migration

  • Article

Interface IType

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, IEquatable<IType>
Remarks

The IType interface implements IEquatable<T>. 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 Nullable<T> type. Note that in case of nullable value types, the current type represents the Nullable<T> 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 way 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.

Equals(Type?, TypeComparison)
MakeArrayType(int)

Creates an array type whose element type is the current type.

MakePointerType()

Creates a pointer type pointing at the current type.

ToNonNullable()

Returns the non-nullable type from the current IType. If the current type is a non-nullable reference type, returns the current type. If the current type is a Nullable<T>, i.e. a nullable value type, returns the underlying type.

ToNullable()

Creates a nullable type from the current IType. If the current type is already nullable, returns the current type. If the type is a value type, returns a Nullable<T> of this type.

ToRef()
ToType()

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

Extension Methods

See Also