GenericTypeHelper Class
Namespace: PTS.Reflection
Assembly: PTS.Reflection.dll
Provides methods for generic system types.
Syntax
public static class GenericTypeHelper
Inheritance
Methods
ToGenericDefinitionVariant(Type, Int32)
Retrieves generic system type definition with specified number of type parameters.
Declaration
public static Type ToGenericDefinitionVariant(this Type type, int genericTypeParamCount)
Parameters
Type | Name | Description |
---|---|---|
System.Type | type | Generic type definition to get variation with specified number of type arguments for. |
System.Int32 | genericTypeParamCount | Number of generic type parameters of target generic type definition variation. |
Returns
Type | Description |
---|---|
System.Type | Generic type definition of the specified type with specified number of type paramenters if available; otherwise |
ToGenericVariant(Type, Type[])
Retrieves generic system type definition and creates a new generic type with specified types as parameters.
Declaration
public static Type ToGenericVariant(this Type type, params Type[] types)
Parameters
Type | Name | Description |
---|---|---|
System.Type | type | Generic type definition to get variation with specified type arguments for. |
System.Type[] | types | Types used as parameters for new generic type variation. |
Returns
Type | Description |
---|---|
System.Type | Generic type definition of the specified type with specified type paramenters if available; otherwise |
ToGenericVariant<T1>(Type)
Retrieves generic system type definition and creates a new generic type with specified types as parameters.
Declaration
public static Type ToGenericVariant<T1>(this Type type)
Parameters
Type | Name | Description |
---|---|---|
System.Type | type | Generic type definition to get variation with specified type argument for. |
Returns
Type | Description |
---|---|
System.Type |
Type Parameters
Name | Description |
---|---|
T1 | Type used as a parameter for new generic type variation. |
ToGenericVariant<T1, T2>(Type)
Retrieves generic system type definition and creates a new generic type with specified types as parameters.
Declaration
public static Type ToGenericVariant<T1, T2>(this Type type)
Parameters
Type | Name | Description |
---|---|---|
System.Type | type | Generic type definition to get variation with specified type arguments for. |
Returns
Type | Description |
---|---|
System.Type |
Type Parameters
Name | Description |
---|---|
T1 | Type used as a parameter for new generic type variation. |
T2 | Type used as a parameter for new generic type variation. |
ToGenericVariant<T1, T2, T3>(Type)
Retrieves generic system type definition and creates a new generic type with specified types as parameters.
Declaration
public static Type ToGenericVariant<T1, T2, T3>(this Type type)
Parameters
Type | Name | Description |
---|---|---|
System.Type | type | Generic type definition to get variation with specified type arguments for. |
Returns
Type | Description |
---|---|
System.Type |
Type Parameters
Name | Description |
---|---|
T1 | Type used as a parameter for new generic type variation. |
T2 | Type used as a parameter for new generic type variation. |
T3 | Type used as a parameter for new generic type variation. |
ToGenericVariant<T1, T2, T3, T4>(Type)
Retrieves generic system type definition and creates a new generic type with specified types as parameters.
Declaration
public static Type ToGenericVariant<T1, T2, T3, T4>(this Type type)
Parameters
Type | Name | Description |
---|---|---|
System.Type | type | Generic type definition to get variation with specified type arguments for. |
Returns
Type | Description |
---|---|
System.Type |
Type Parameters
Name | Description |
---|---|
T1 | Type used as a parameter for new generic type variation. |
T2 | Type used as a parameter for new generic type variation. |
T3 | Type used as a parameter for new generic type variation. |
T4 | Type used as a parameter for new generic type variation. |