Class TypeSlimExtensions
Provides a set of extension methods for types and lightweight types.
Inheritance
Namespace: System.Reflection
Assembly: Nuqleon.Linq.Expressions.Bonsai.dll
Syntax
public static class TypeSlimExtensions : Object
Methods
GetConstructor(TypeSlim, ReadOnlyCollection<TypeSlim>)
Get a slim representation of a constructor for the type.
Declaration
public static ConstructorInfoSlim GetConstructor(this TypeSlim type, ReadOnlyCollection<TypeSlim> parameterTypes)
Parameters
Type | Name | Description |
---|---|---|
TypeSlim | type | Type declaring the member. |
System.Collections.ObjectModel.ReadOnlyCollection<TypeSlim> | parameterTypes | Types of the parameters. |
Returns
Type | Description |
---|---|
ConstructorInfoSlim | The slim constructor info. |
GetField(TypeSlim, String, TypeSlim)
Get a slim representation of a field for the type.
Declaration
public static FieldInfoSlim GetField(this TypeSlim type, string name, TypeSlim fieldType)
Parameters
Type | Name | Description |
---|---|---|
TypeSlim | type | Type declaring the member. |
System.String | name | Name of the field. |
TypeSlim | fieldType | Type of the field. |
Returns
Type | Description |
---|---|
FieldInfoSlim | The slim field info. |
GetGenericDefinitionMethod(TypeSlim, String, ReadOnlyCollection<TypeSlim>, ReadOnlyCollection<TypeSlim>, TypeSlim)
Get a slim representation of a generic definition method for the type.
Declaration
public static GenericDefinitionMethodInfoSlim GetGenericDefinitionMethod(this TypeSlim type, string name, ReadOnlyCollection<TypeSlim> genericParameterTypes, ReadOnlyCollection<TypeSlim> parameterTypes, TypeSlim returnType)
Parameters
Type | Name | Description |
---|---|---|
TypeSlim | type | Type declaring the member. |
System.String | name | Name of the method. |
System.Collections.ObjectModel.ReadOnlyCollection<TypeSlim> | genericParameterTypes | Generic parameter types. |
System.Collections.ObjectModel.ReadOnlyCollection<TypeSlim> | parameterTypes | Type of the method parameters. |
TypeSlim | returnType | Return type of the method. |
Returns
Type | Description |
---|---|
GenericDefinitionMethodInfoSlim | The slim generic definition method info. |
GetGenericMethod(TypeSlim, GenericDefinitionMethodInfoSlim, ReadOnlyCollection<TypeSlim>)
Get a slim representation of a closed generic method for the type.
Declaration
public static GenericMethodInfoSlim GetGenericMethod(this TypeSlim type, GenericDefinitionMethodInfoSlim methodDefinition, ReadOnlyCollection<TypeSlim> arguments)
Parameters
Type | Name | Description |
---|---|---|
TypeSlim | type | Type declaring the member. |
GenericDefinitionMethodInfoSlim | methodDefinition | Generic method definition. |
System.Collections.ObjectModel.ReadOnlyCollection<TypeSlim> | arguments | Generic type arguments. |
Returns
Type | Description |
---|---|
GenericMethodInfoSlim | The slim closed generic method info. |
GetProperty(TypeSlim, String, TypeSlim, ReadOnlyCollection<TypeSlim>, Boolean)
Get a slim representation of a property for the type.
Declaration
public static PropertyInfoSlim GetProperty(this TypeSlim type, string name, TypeSlim propertyType, ReadOnlyCollection<TypeSlim> indexParameterTypes, bool canWrite)
Parameters
Type | Name | Description |
---|---|---|
TypeSlim | type | Type declaring the member. |
System.String | name | Name of the property. |
TypeSlim | propertyType | Type of the property. |
System.Collections.ObjectModel.ReadOnlyCollection<TypeSlim> | indexParameterTypes | Types of the indexer parameters, if the property is indexed. Otherwise, an empty collection. |
System.Boolean | canWrite | true if property is writable, false otherwise |
Returns
Type | Description |
---|---|
PropertyInfoSlim | The slim property info. |
GetSimpleMethod(TypeSlim, String, ReadOnlyCollection<TypeSlim>, TypeSlim)
Get a slim representation of a simple method for the type.
Declaration
public static SimpleMethodInfoSlim GetSimpleMethod(this TypeSlim type, string name, ReadOnlyCollection<TypeSlim> parameterTypes, TypeSlim returnType)
Parameters
Type | Name | Description |
---|---|---|
TypeSlim | type | Type declaring the member. |
System.String | name | Name of the method. |
System.Collections.ObjectModel.ReadOnlyCollection<TypeSlim> | parameterTypes | Type of the method parameters. |
TypeSlim | returnType | Return type of the method. |
Returns
Type | Description |
---|---|
SimpleMethodInfoSlim | The slim simple method info. |
ToType(TypeSlim)
Converts the lightweight representation of a type to a type.
Declaration
public static Type ToType(this TypeSlim type)
Parameters
Type | Name | Description |
---|---|---|
TypeSlim | type | Slim type to convert. |
Returns
Type | Description |
---|---|
System.Type | Type represented by the slim type. |
ToType(TypeSlim, IReflectionProvider)
Converts the lightweight representation of a type to a type.
Declaration
public static Type ToType(this TypeSlim type, IReflectionProvider provider)
Parameters
Type | Name | Description |
---|---|---|
TypeSlim | type | Slim type to convert. |
IReflectionProvider | provider | Reflection provider to use for type lookup and type construction. |
Returns
Type | Description |
---|---|
System.Type | Type represented by the slim type. |
ToTypeSlim(Type)
Converts the specified type to a lightweight representation.
Declaration
public static TypeSlim ToTypeSlim(this Type type)
Parameters
Type | Name | Description |
---|---|---|
System.Type | type | Type to convert. |
Returns
Type | Description |
---|---|
TypeSlim | Lightweight representation of the specified type. |