C# Class System.Dynamic.Utils.TypeUtils

Show file Open project: dotnet/corefx

Private Properties

Property Type Description
FindConversionOperator System.Reflection.MethodInfo
IsContravariant bool
IsCovariant bool
IsDelegate bool
IsFloatingPoint bool
IsImplicitBoxingConversion bool
IsImplicitNullableConversion bool
IsImplicitNumericConversion bool
IsImplicitReferenceConversion bool
IsInvariant bool
IsUnsigned bool

Public Methods

Method Description
AreEquivalent ( Type t1, Type t2 ) : bool
AreReferenceAssignable ( Type dest, Type src ) : bool
CanCache ( this t ) : bool

We can cache references to types, as long as they aren't in collectible assemblies. Unfortunately, we can't really distinguish between different flavors of assemblies. But, we can at least create a cache for types in mscorlib (so we get the primitives, etc).

FindGenericType ( Type definition, Type type ) : Type
GetBooleanOperator ( Type type, string name ) : MethodInfo

Searches for an operator method on the type. The method must have the specified signature, no generic arguments, and have the SpecialName bit set. Also searches inherited operator methods. NOTE: This was designed to satisfy the needs of op_True and op_False, because we have to do runtime lookup for those. It may not work right for unary operators in general.

GetNonNullableType ( this type ) : Type
GetNonRefType ( this type ) : Type
GetNullableType ( this type ) : Type
GetUserDefinedCoercionMethod ( Type convertFrom, Type convertToType ) : MethodInfo
HasBuiltInEqualityOperator ( Type left, Type right ) : bool
HasIdentityPrimitiveOrNullableConversionTo ( this source, Type dest ) : bool
HasReferenceConversionTo ( this source, Type dest ) : bool
HasReferenceEquality ( Type left, Type right ) : bool
IsArithmetic ( this type ) : bool
IsBool ( this type ) : bool
IsConvertible ( this type ) : bool
IsImplicitlyConvertibleTo ( this source, Type destination ) : bool
IsInteger ( this type ) : bool
IsInteger64 ( this type ) : bool
IsIntegerOrBool ( this type ) : bool
IsLegalExplicitVariantDelegateConversion ( Type source, Type dest ) : bool
IsNullableOrReferenceType ( this type ) : bool
IsNullableType ( this type ) : bool
IsNumeric ( this type ) : bool
IsNumericOrBool ( this type ) : bool
IsSameOrSubclass ( Type type, Type subType ) : bool
IsUnsignedInt ( this type ) : bool
IsValidInstanceType ( MemberInfo member, Type instanceType ) : bool
IsVector ( this type ) : bool
ValidateType ( Type type, string paramName ) : void
ValidateType ( Type type, string paramName, int index ) : void

Private Methods

Method Description
FindConversionOperator ( MethodInfo methods, Type typeFrom, Type typeTo ) : MethodInfo
IsContravariant ( Type t ) : bool
IsCovariant ( Type t ) : bool
IsDelegate ( Type t ) : bool
IsFloatingPoint ( this type ) : bool
IsImplicitBoxingConversion ( Type source, Type destination ) : bool
IsImplicitNullableConversion ( Type source, Type destination ) : bool
IsImplicitNumericConversion ( Type source, Type destination ) : bool
IsImplicitReferenceConversion ( Type source, Type destination ) : bool
IsInvariant ( Type t ) : bool
IsUnsigned ( this type ) : bool

Method Details

AreEquivalent() public static method

public static AreEquivalent ( Type t1, Type t2 ) : bool
t1 Type
t2 Type
return bool

AreReferenceAssignable() public static method

public static AreReferenceAssignable ( Type dest, Type src ) : bool
dest Type
src Type
return bool

CanCache() public static method

We can cache references to types, as long as they aren't in collectible assemblies. Unfortunately, we can't really distinguish between different flavors of assemblies. But, we can at least create a cache for types in mscorlib (so we get the primitives, etc).
public static CanCache ( this t ) : bool
t this
return bool

FindGenericType() public static method

public static FindGenericType ( Type definition, Type type ) : Type
definition Type
type Type
return Type

GetBooleanOperator() public static method

Searches for an operator method on the type. The method must have the specified signature, no generic arguments, and have the SpecialName bit set. Also searches inherited operator methods. NOTE: This was designed to satisfy the needs of op_True and op_False, because we have to do runtime lookup for those. It may not work right for unary operators in general.
public static GetBooleanOperator ( Type type, string name ) : MethodInfo
type Type
name string
return System.Reflection.MethodInfo

GetNonNullableType() public static method

public static GetNonNullableType ( this type ) : Type
type this
return Type

GetNonRefType() public static method

public static GetNonRefType ( this type ) : Type
type this
return Type

GetNullableType() public static method

public static GetNullableType ( this type ) : Type
type this
return Type

GetUserDefinedCoercionMethod() public static method

public static GetUserDefinedCoercionMethod ( Type convertFrom, Type convertToType ) : MethodInfo
convertFrom Type
convertToType Type
return System.Reflection.MethodInfo

HasBuiltInEqualityOperator() public static method

public static HasBuiltInEqualityOperator ( Type left, Type right ) : bool
left Type
right Type
return bool

HasIdentityPrimitiveOrNullableConversionTo() public static method

public static HasIdentityPrimitiveOrNullableConversionTo ( this source, Type dest ) : bool
source this
dest Type
return bool

HasReferenceConversionTo() public static method

public static HasReferenceConversionTo ( this source, Type dest ) : bool
source this
dest Type
return bool

HasReferenceEquality() public static method

public static HasReferenceEquality ( Type left, Type right ) : bool
left Type
right Type
return bool

IsArithmetic() public static method

public static IsArithmetic ( this type ) : bool
type this
return bool

IsBool() public static method

public static IsBool ( this type ) : bool
type this
return bool

IsConvertible() public static method

public static IsConvertible ( this type ) : bool
type this
return bool

IsImplicitlyConvertibleTo() public static method

public static IsImplicitlyConvertibleTo ( this source, Type destination ) : bool
source this
destination Type
return bool

IsInteger() public static method

public static IsInteger ( this type ) : bool
type this
return bool

IsInteger64() public static method

public static IsInteger64 ( this type ) : bool
type this
return bool

IsIntegerOrBool() public static method

public static IsIntegerOrBool ( this type ) : bool
type this
return bool

IsLegalExplicitVariantDelegateConversion() public static method

public static IsLegalExplicitVariantDelegateConversion ( Type source, Type dest ) : bool
source Type
dest Type
return bool

IsNullableOrReferenceType() public static method

public static IsNullableOrReferenceType ( this type ) : bool
type this
return bool

IsNullableType() public static method

public static IsNullableType ( this type ) : bool
type this
return bool

IsNumeric() public static method

public static IsNumeric ( this type ) : bool
type this
return bool

IsNumericOrBool() public static method

public static IsNumericOrBool ( this type ) : bool
type this
return bool

IsSameOrSubclass() public static method

public static IsSameOrSubclass ( Type type, Type subType ) : bool
type Type
subType Type
return bool

IsUnsignedInt() public static method

public static IsUnsignedInt ( this type ) : bool
type this
return bool

IsValidInstanceType() public static method

public static IsValidInstanceType ( MemberInfo member, Type instanceType ) : bool
member System.Reflection.MemberInfo
instanceType Type
return bool

IsVector() public static method

public static IsVector ( this type ) : bool
type this
return bool

ValidateType() public static method

public static ValidateType ( Type type, string paramName ) : void
type Type
paramName string
return void

ValidateType() public static method

public static ValidateType ( Type type, string paramName, int index ) : void
type Type
paramName string
index int
return void