Table of Contents

Class TypeExtensions

Namespace
NextORM.Core
Assembly
nextorm.core.dll

Helpers for classifying runtime types and comparing them while building queries.

public static class TypeExtensions
Inheritance
TypeExtensions
Inherited Members

Methods

IsAnonymous(Type)

Determines whether the type is a compiler-generated anonymous type (its name starts with <>f__AnonymousType).

public static bool IsAnonymous(this Type type)

Parameters

type Type

The type to test.

Returns

bool

true for an anonymous type; otherwise false.

IsClosure(Type)

Determines whether the type is a compiler-generated closure (display class) created to hold variables captured by a lambda.

public static bool IsClosure(this Type type)

Parameters

type Type

The type to test.

Returns

bool

true for a closure type; otherwise false.

IsScalar(Type)

Determines whether the type maps to a single scalar SQL value, i.e. it has a type code other than Object.

public static bool IsScalar(this Type type)

Parameters

type Type

The type to test.

Returns

bool

true when the type is scalar; otherwise false.

IsTuple(Type)

Determines whether the type is a tuple type, identified by a generic System.Tuple or System.ValueTuple name.

public static bool IsTuple(this Type type)

Parameters

type Type

The type to test.

Returns

bool

true for a tuple type; otherwise false.

Similar(Type, Type)

Determines whether the two types are assignment-compatible in either direction. Equal types and types assignable to one another match; a nullable type is also compared through its underlying type.

public static bool Similar(this Type x, Type y)

Parameters

x Type

The first type.

y Type

The second type.

Returns

bool

true when the types are considered similar; otherwise false.

TryGetProjectionDimension(Type, out int)

Tries to get the number of columns a projection type materializes. A projection is a generic type implementing IProjection; its dimension is its number of generic arguments.

public static bool TryGetProjectionDimension(this Type type, out int dim)

Parameters

type Type

The type to inspect.

dim int

When this method returns true, the projection's generic arity; otherwise 0.

Returns

bool

true when type is a projection; otherwise false.