Class TypeExtensions
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
typeTypeThe type to test.
Returns
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
typeTypeThe type to test.
Returns
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
typeTypeThe type to test.
Returns
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
typeTypeThe type to test.
Returns
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
Returns
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
typeTypeThe type to inspect.
dimintWhen this method returns true, the projection's generic arity; otherwise
0.