C# Class NUnit.Framework.Internal.TypeHelper

TypeHelper provides static methods that operate on Types.
显示文件 Open project: pjcollins/Andr.Unit Class Usage Examples

Public Methods

Method Description
BestCommonType ( Type type1, Type type2 ) : Type

Returns the best fit for a common type to be used in matching actual arguments to a methods Type parameters.

CanDeduceTypeArgsFromArgs ( Type type, object arglist, Type &typeArgsOut ) : bool

Determines whether this instance can deduce type args for a generic type from the supplied arguments.

ConvertArgumentList ( object arglist, ParameterInfo parameters ) : void

Convert an argument list to the required paramter types. Currently, only widening numeric conversions are performed.

GetDisplayName ( Type type ) : string

Gets the display name for a Type as used by NUnit.

GetDisplayName ( Type type, object arglist ) : string

Gets the display name for a Type as used by NUnit.

GetEnumValues ( Type enumType ) : Array

Gets the values for an enumeration, using Enum.GetTypes where available, otherwise through reflection.

IsNumeric ( Type type ) : bool

Determines whether the specified type is numeric.

MakeGenericType ( Type type, Type typeArgs ) : Type

Creates an instance of a generic Type using the supplied Type arguments

Method Details

BestCommonType() public static method

Returns the best fit for a common type to be used in matching actual arguments to a methods Type parameters.
public static BestCommonType ( Type type1, Type type2 ) : Type
type1 System.Type The first type.
type2 System.Type The second type.
return System.Type

CanDeduceTypeArgsFromArgs() public static method

Determines whether this instance can deduce type args for a generic type from the supplied arguments.
public static CanDeduceTypeArgsFromArgs ( Type type, object arglist, Type &typeArgsOut ) : bool
type System.Type The type to be examined.
arglist object The arglist.
typeArgsOut System.Type The type args to be used.
return bool

ConvertArgumentList() public static method

Convert an argument list to the required paramter types. Currently, only widening numeric conversions are performed.
public static ConvertArgumentList ( object arglist, ParameterInfo parameters ) : void
arglist object An array of args to be converted
parameters System.Reflection.ParameterInfo A ParamterInfo[] whose types will be used as targets
return void

GetDisplayName() public static method

Gets the display name for a Type as used by NUnit.
public static GetDisplayName ( Type type ) : string
type System.Type The Type for which a display name is needed.
return string

GetDisplayName() public static method

Gets the display name for a Type as used by NUnit.
public static GetDisplayName ( Type type, object arglist ) : string
type System.Type The Type for which a display name is needed.
arglist object The arglist provided.
return string

GetEnumValues() public static method

Gets the values for an enumeration, using Enum.GetTypes where available, otherwise through reflection.
public static GetEnumValues ( Type enumType ) : Array
enumType System.Type
return System.Array

IsNumeric() public static method

Determines whether the specified type is numeric.
public static IsNumeric ( Type type ) : bool
type System.Type The type to be examined.
return bool

MakeGenericType() public static method

Creates an instance of a generic Type using the supplied Type arguments
public static MakeGenericType ( Type type, Type typeArgs ) : Type
type System.Type The generic type to be specialized.
typeArgs System.Type The type args.
return System.Type