Open sandboxFocus

Interface IArrayType

Represents an array, e.g. T[].

Namespace: Metalama.Framework.Code.Types
Assembly: Metalama.Framework.dll
Syntax
public interface IArrayType : IType, ICompilationElement, IDisplayable, IEquatable<IType>
Remarks

To create an IArrayType, call the MakeArrayType(int) method on any IType instance. For example: intType.MakeArrayType() creates int[], and intType.MakeArrayType(2) creates int[,].

You can also obtain array types from existing declarations in the code model.

Properties

Name Description
ElementType

Gets the element type, e.g. the T in T[].

Rank

Gets the array rank (1 for T[], 2 for T[,], ...).

Methods

Name Description
StripNullabilityAnnotation()

Strips the nullability annotation from the current type, returning an unannotated version.

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.

Extension Methods

See Also