Open sandboxFocus

Interface IDynamicType

Represents the dynamic type, which bypasses compile-time type checking.

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

The dynamic type in C# enables dynamic binding at run time. Operations involving dynamic types are resolved at run time rather than compile time.

In the Metalama type system, IDynamicType is a distinct type kind from INamedType. You can check for the dynamic type using TypeKind returning Dynamic.

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