C# Class System.Type

Represents type declarations: class types, interface types, array types, value types, and enumeration types.
Inheritance: System.Reflection.MemberInfo
Mostrar archivo Open project: kswoll/WootzJs Class Usage Examples

Public Properties

Property Type Description
DefaultBinder Binder
EmptyTypes Type[]

Public Methods

Method Description
CreateTypeParameter ( string fullName, JsTypeFunction baseType ) : Type
GetConstructor ( BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type types, ParameterModifier modifiers ) : ConstructorInfo

Searches for a constructor whose parameters match the specified argument types and modifiers, using the specified binding constraints and the specified calling convention.

GetConstructor ( BindingFlags bindingAttr, Binder binder, Type types, ParameterModifier modifiers ) : ConstructorInfo

Searches for a constructor whose parameters match the specified argument types and modifiers, using the specified binding constraints.

GetConstructor ( Type types ) : ConstructorInfo

Searches for a public instance constructor whose parameters match the types in the specified array.

GetConstructors ( ) : ConstructorInfo[]
GetElementType ( ) : Type
GetEnumNames ( ) : string[]
GetEnumValues ( ) : Array
GetEvent ( string name ) : EventInfo
GetEvents ( ) : EventInfo[]
GetField ( string name ) : FieldInfo

Searches for the public field with the specified name.

GetField ( string name, BindingFlags bindingAttr ) : FieldInfo

Searches for the specified field, using the specified binding constraints.

GetFields ( ) : FieldInfo[]

Returns all the public fields of the current T:System.Type.

GetFields ( BindingFlags bindingAttr ) : FieldInfo[]

When overridden in a derived class, searches for the fields defined for the current T:System.Type, using the specified binding constraints.

GetGenericArguments ( ) : Type[]

Returns an array of T:System.Type objects that represent the type arguments of a generic type or the type parameters of a generic type definition.

GetGenericTypeDefinition ( ) : Type

Returns a T:System.Type object that represents a generic type definition from which the current generic type can be constructed.

GetInterfaces ( ) : Type[]

When overridden in a derived class, gets all the interfaces implemented or inherited by the current T:System.Type.

GetMethod ( string name ) : MethodInfo

Searches for the public method with the specified name.

GetMethod ( string name, BindingFlags bindingAttr ) : MethodInfo

Searches for the specified method, using the specified binding constraints.

GetMethod ( string name, Type types ) : MethodInfo

Searches for the specified public method whose parameters match the specified argument types.

GetMethods ( ) : MethodInfo[]
GetProperties ( ) : PropertyInfo[]
GetProperty ( string name ) : PropertyInfo

Searches for the public property with the specified name.

GetProperty ( string name, BindingFlags bindingAttr ) : PropertyInfo

Searches for the specified property, using the specified binding constraints.

GetProperty ( string name, BindingFlags bindingAttr, Binder binder, Type returnType, Type types, ParameterModifier modifiers ) : PropertyInfo

Searches for the specified property whose parameters match the specified argument types and modifiers, using the specified binding constraints.

GetProperty ( string name, Type types ) : PropertyInfo

Searches for the specified public property whose parameters match the specified argument types.

GetProperty ( string name, Type returnType, Type types ) : PropertyInfo

Searches for the specified public property whose parameters match the specified argument types.

GetProperty ( string name, Type returnType, Type types, ParameterModifier modifiers ) : PropertyInfo

Searches for the specified public property whose parameters match the specified argument types and modifiers.

GetType ( string typeName ) : Type
GetTypeFromHandle ( RuntimeTypeHandle typeHandle ) : Type
Init ( string fullName, int flags, JsTypeFunction thisType, JsTypeFunction baseType, JsTypeFunction interfaces, JsTypeFunction typeArguments, FieldInfo fields, MethodInfo methods, ConstructorInfo constructors, PropertyInfo properties, EventInfo events, JsTypeFunction elementType, JsTypeFunction unconstructedType ) : void
IsAssignableFrom ( Type type ) : bool
IsInstanceOfType ( object o ) : bool

Determines whether the specified object is an instance of the current T:System.Type.

MakeArrayType ( ) : Type
MakeArrayType ( int rank ) : Type
MakeGenericType ( ) : Type

Substitutes the elements of an array of types for the type parameters of the current generic type definition and returns a T:System.Type object representing the resulting constructed type.

ToString ( ) : string
Type ( string name, Attribute attributes ) : System.Collections.Generic
_GetTypeFromTypeFunc ( JsTypeFunction typeFunction ) : Type

Protected Methods

Method Description
GetConstructorImpl ( BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type types, ParameterModifier modifiers ) : ConstructorInfo

When overridden in a derived class, searches for a constructor whose parameters match the specified argument types and modifiers, using the specified binding constraints and the specified calling convention.

GetPropertyImpl ( string name, BindingFlags bindingAttr, Binder binder, Type returnType, Type types, ParameterModifier modifiers ) : PropertyInfo

When overridden in a derived class, searches for the specified property whose parameters match the specified argument types and modifiers, using the specified binding constraints.

Private Methods

Method Description
GetGenericTypeArgument ( int index ) : Type
GetGenericTypeArgumentCount ( ) : int
GetInterface ( int index ) : Type
GetInterfaceCount ( ) : int
GetMethodImpl ( string name, BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type types, ParameterModifier modifiers ) : MethodInfo
GetProperty ( string name, BindingFlags bindingAttr, Type returnType ) : PropertyInfo
_GetTypeFromInstance ( JsObject instance ) : Type

Method Details

CreateTypeParameter() public static method

public static CreateTypeParameter ( string fullName, JsTypeFunction baseType ) : Type
fullName string
baseType JsTypeFunction
return Type

GetConstructor() public method

Searches for a constructor whose parameters match the specified argument types and modifiers, using the specified binding constraints and the specified calling convention.
is null.-or- One of the elements in is null. is multidimensional.-or- is multidimensional.-or- and do not have the same length.
public GetConstructor ( BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type types, ParameterModifier modifiers ) : ConstructorInfo
bindingAttr BindingFlags A bitmask comprised of one or more that specify how the search is conducted.-or- Zero, to return null.
binder Binder An object that defines a set of properties and enables binding, which can involve selection of an overloaded method, coercion of argument types, and invocation of a member through reflection.-or- A null reference (Nothing in Visual Basic), to use the .
callConvention CallingConventions The object that specifies the set of rules to use regarding the order and layout of arguments, how the return value is passed, what registers are used for arguments, and the stack is cleaned up.
types Type An array of objects representing the number, order, and type of the parameters for the constructor to get.-or- An empty array of the type (that is, Type[] types = new Type[0]) to get a constructor that takes no parameters.
modifiers ParameterModifier An array of objects representing the attributes associated with the corresponding element in the array. The default binder does not process this parameter.
return ConstructorInfo

GetConstructor() public method

Searches for a constructor whose parameters match the specified argument types and modifiers, using the specified binding constraints.
is null.-or- One of the elements in is null. is multidimensional.-or- is multidimensional.-or- and do not have the same length.
public GetConstructor ( BindingFlags bindingAttr, Binder binder, Type types, ParameterModifier modifiers ) : ConstructorInfo
bindingAttr BindingFlags A bitmask comprised of one or more that specify how the search is conducted.-or- Zero, to return null.
binder Binder An object that defines a set of properties and enables binding, which can involve selection of an overloaded method, coercion of argument types, and invocation of a member through reflection.-or- A null reference (Nothing in Visual Basic), to use the .
types Type An array of objects representing the number, order, and type of the parameters for the constructor to get.-or- An empty array of the type (that is, Type[] types = new Type[0]) to get a constructor that takes no parameters.-or- .
modifiers ParameterModifier An array of objects representing the attributes associated with the corresponding element in the parameter type array. The default binder does not process this parameter.
return ConstructorInfo

GetConstructor() public method

Searches for a public instance constructor whose parameters match the types in the specified array.
is null.-or- One of the elements in is null. is multidimensional.
public GetConstructor ( Type types ) : ConstructorInfo
types Type An array of objects representing the number, order, and type of the parameters for the desired constructor.-or- An empty array of objects, to get a constructor that takes no parameters. Such an empty array is provided by the static field .
return ConstructorInfo

GetConstructorImpl() protected method

When overridden in a derived class, searches for a constructor whose parameters match the specified argument types and modifiers, using the specified binding constraints and the specified calling convention.
is null.-or- One of the elements in is null. is multidimensional.-or- is multidimensional.-or- and do not have the same length. The current type is a or .
protected GetConstructorImpl ( BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type types, ParameterModifier modifiers ) : ConstructorInfo
bindingAttr BindingFlags A bitmask comprised of one or more that specify how the search is conducted.-or- Zero, to return null.
binder Binder An object that defines a set of properties and enables binding, which can involve selection of an overloaded method, coercion of argument types, and invocation of a member through reflection.-or- A null reference (Nothing in Visual Basic), to use the .
callConvention CallingConventions The object that specifies the set of rules to use regarding the order and layout of arguments, how the return value is passed, what registers are used for arguments, and the stack is cleaned up.
types Type An array of objects representing the number, order, and type of the parameters for the constructor to get.-or- An empty array of the type (that is, Type[] types = new Type[0]) to get a constructor that takes no parameters.
modifiers ParameterModifier An array of objects representing the attributes associated with the corresponding element in the array. The default binder does not process this parameter.
return ConstructorInfo

GetConstructors() public method

public GetConstructors ( ) : ConstructorInfo[]
return ConstructorInfo[]

GetElementType() public method

public GetElementType ( ) : Type
return Type

GetEnumNames() public method

public GetEnumNames ( ) : string[]
return string[]

GetEnumValues() public method

public GetEnumValues ( ) : Array
return Array

GetEvent() public method

public GetEvent ( string name ) : EventInfo
name string
return EventInfo

GetEvents() public method

public GetEvents ( ) : EventInfo[]
return EventInfo[]

GetField() public method

Searches for the public field with the specified name.
is null. This object is a whose method has not yet been called.
public GetField ( string name ) : FieldInfo
name string The string containing the name of the data field to get.
return FieldInfo

GetField() public method

Searches for the specified field, using the specified binding constraints.
is null.
public GetField ( string name, BindingFlags bindingAttr ) : FieldInfo
name string The string containing the name of the data field to get.
bindingAttr BindingFlags A bitmask comprised of one or more that specify how the search is conducted.-or- Zero, to return null.
return FieldInfo

GetFields() public method

Returns all the public fields of the current T:System.Type.
public GetFields ( ) : FieldInfo[]
return FieldInfo[]

GetFields() public method

When overridden in a derived class, searches for the fields defined for the current T:System.Type, using the specified binding constraints.
public GetFields ( BindingFlags bindingAttr ) : FieldInfo[]
bindingAttr BindingFlags A bitmask comprised of one or more that specify how the search is conducted.-or- Zero, to return null.
return FieldInfo[]

GetGenericArguments() public method

Returns an array of T:System.Type objects that represent the type arguments of a generic type or the type parameters of a generic type definition.
The invoked method is not supported in the base class. Derived classes must provide an implementation.
public GetGenericArguments ( ) : Type[]
return Type[]

GetGenericTypeDefinition() public method

Returns a T:System.Type object that represents a generic type definition from which the current generic type can be constructed.
The current type is not a generic type. That is, returns false. The invoked method is not supported in the base class. Derived classes must provide an implementation.
public GetGenericTypeDefinition ( ) : Type
return Type

GetInterfaces() public method

When overridden in a derived class, gets all the interfaces implemented or inherited by the current T:System.Type.
A static initializer is invoked and throws an exception.
public GetInterfaces ( ) : Type[]
return Type[]

GetMethod() public method

Searches for the public method with the specified name.
More than one method is found with the specified name. is null.
public GetMethod ( string name ) : MethodInfo
name string The string containing the name of the public method to get.
return MethodInfo

GetMethod() public method

Searches for the specified method, using the specified binding constraints.
More than one method is found with the specified name and matching the specified binding constraints. is null.
public GetMethod ( string name, BindingFlags bindingAttr ) : MethodInfo
name string The string containing the name of the method to get.
bindingAttr BindingFlags A bitmask comprised of one or more that specify how the search is conducted.-or- Zero, to return null.
return MethodInfo

GetMethod() public method

Searches for the specified public method whose parameters match the specified argument types.
More than one method is found with the specified name and specified parameters. is null.-or- is null.-or- One of the elements in is null. is multidimensional.
public GetMethod ( string name, Type types ) : MethodInfo
name string The string containing the name of the public method to get.
types Type An array of objects representing the number, order, and type of the parameters for the method to get.-or- An empty array of objects (as provided by the field) to get a method that takes no parameters.
return MethodInfo

GetMethods() public method

public GetMethods ( ) : MethodInfo[]
return MethodInfo[]

GetProperties() public method

public GetProperties ( ) : PropertyInfo[]
return PropertyInfo[]

GetProperty() public method

Searches for the public property with the specified name.
More than one property is found with the specified name. See Remarks. is null.
public GetProperty ( string name ) : PropertyInfo
name string The string containing the name of the public property to get.
return PropertyInfo

GetProperty() public method

Searches for the specified property, using the specified binding constraints.
More than one property is found with the specified name and matching the specified binding constraints. See Remarks. is null.
public GetProperty ( string name, BindingFlags bindingAttr ) : PropertyInfo
name string The string containing the name of the property to get.
bindingAttr BindingFlags A bitmask comprised of one or more that specify how the search is conducted.-or- Zero, to return null.
return PropertyInfo

GetProperty() public method

Searches for the specified property whose parameters match the specified argument types and modifiers, using the specified binding constraints.
More than one property is found with the specified name and matching the specified binding constraints. is null.-or- is null. is multidimensional.-or- is multidimensional.-or- and do not have the same length. An element of is null.
public GetProperty ( string name, BindingFlags bindingAttr, Binder binder, Type returnType, Type types, ParameterModifier modifiers ) : PropertyInfo
name string The string containing the name of the property to get.
bindingAttr BindingFlags A bitmask comprised of one or more that specify how the search is conducted.-or- Zero, to return null.
binder Binder An object that defines a set of properties and enables binding, which can involve selection of an overloaded method, coercion of argument types, and invocation of a member through reflection.-or- A null reference (Nothing in Visual Basic), to use the .
returnType Type The return type of the property.
types Type An array of objects representing the number, order, and type of the parameters for the indexed property to get.-or- An empty array of the type (that is, Type[] types = new Type[0]) to get a property that is not indexed.
modifiers ParameterModifier An array of objects representing the attributes associated with the corresponding element in the array. The default binder does not process this parameter.
return PropertyInfo

GetProperty() public method

Searches for the specified public property whose parameters match the specified argument types.
More than one property is found with the specified name and matching the specified argument types. is null.-or- is null. is multidimensional. An element of is null.
public GetProperty ( string name, Type types ) : PropertyInfo
name string The string containing the name of the public property to get.
types Type An array of objects representing the number, order, and type of the parameters for the indexed property to get.-or- An empty array of the type (that is, Type[] types = new Type[0]) to get a property that is not indexed.
return PropertyInfo

GetProperty() public method

Searches for the specified public property whose parameters match the specified argument types.
More than one property is found with the specified name and matching the specified argument types. is null.-or- is null. is multidimensional. An element of is null.
public GetProperty ( string name, Type returnType, Type types ) : PropertyInfo
name string The string containing the name of the public property to get.
returnType Type The return type of the property.
types Type An array of objects representing the number, order, and type of the parameters for the indexed property to get.-or- An empty array of the type (that is, Type[] types = new Type[0]) to get a property that is not indexed.
return PropertyInfo

GetProperty() public method

Searches for the specified public property whose parameters match the specified argument types and modifiers.
More than one property is found with the specified name and matching the specified argument types and modifiers. is null.-or- is null. is multidimensional.-or- is multidimensional.-or- and do not have the same length. An element of is null.
public GetProperty ( string name, Type returnType, Type types, ParameterModifier modifiers ) : PropertyInfo
name string The string containing the name of the public property to get.
returnType Type The return type of the property.
types Type An array of objects representing the number, order, and type of the parameters for the indexed property to get.-or- An empty array of the type (that is, Type[] types = new Type[0]) to get a property that is not indexed.
modifiers ParameterModifier An array of objects representing the attributes associated with the corresponding element in the array. The default binder does not process this parameter.
return PropertyInfo

GetPropertyImpl() protected method

When overridden in a derived class, searches for the specified property whose parameters match the specified argument types and modifiers, using the specified binding constraints.
More than one property is found with the specified name and matching the specified binding constraints. is null.-or- is null.-or- One of the elements in is null. is multidimensional.-or- is multidimensional.-or- and do not have the same length. The current type is a , , or .
protected GetPropertyImpl ( string name, BindingFlags bindingAttr, Binder binder, Type returnType, Type types, ParameterModifier modifiers ) : PropertyInfo
name string The string containing the name of the property to get.
bindingAttr BindingFlags A bitmask comprised of one or more that specify how the search is conducted.-or- Zero, to return null.
binder Binder An object that defines a set of properties and enables binding, which can involve selection of an overloaded member, coercion of argument types, and invocation of a member through reflection.-or- A null reference (Nothing in Visual Basic), to use the .
returnType Type The return type of the property.
types Type An array of objects representing the number, order, and type of the parameters for the indexed property to get.-or- An empty array of the type (that is, Type[] types = new Type[0]) to get a property that is not indexed.
modifiers ParameterModifier An array of objects representing the attributes associated with the corresponding element in the array. The default binder does not process this parameter.
return PropertyInfo

GetType() public static method

public static GetType ( string typeName ) : Type
typeName string
return Type

GetTypeFromHandle() public static method

public static GetTypeFromHandle ( RuntimeTypeHandle typeHandle ) : Type
typeHandle RuntimeTypeHandle
return Type

Init() public method

public Init ( string fullName, int flags, JsTypeFunction thisType, JsTypeFunction baseType, JsTypeFunction interfaces, JsTypeFunction typeArguments, FieldInfo fields, MethodInfo methods, ConstructorInfo constructors, PropertyInfo properties, EventInfo events, JsTypeFunction elementType, JsTypeFunction unconstructedType ) : void
fullName string
flags int
thisType JsTypeFunction
baseType JsTypeFunction
interfaces JsTypeFunction
typeArguments JsTypeFunction
fields FieldInfo
methods MethodInfo
constructors ConstructorInfo
properties PropertyInfo
events EventInfo
elementType JsTypeFunction
unconstructedType JsTypeFunction
return void

IsAssignableFrom() public method

public IsAssignableFrom ( Type type ) : bool
type Type
return bool

IsInstanceOfType() public method

Determines whether the specified object is an instance of the current T:System.Type.
public IsInstanceOfType ( object o ) : bool
o object The object to compare with the current type.
return bool

MakeArrayType() public method

public MakeArrayType ( ) : Type
return Type

MakeArrayType() public method

public MakeArrayType ( int rank ) : Type
rank int
return Type

MakeGenericType() public method

Substitutes the elements of an array of types for the type parameters of the current generic type definition and returns a T:System.Type object representing the resulting constructed type.
The current type does not represent a generic type definition. That is, returns false. is null.-or- Any element of is null. The number of elements in is not the same as the number of type parameters in the current generic type definition.-or- Any element of does not satisfy the constraints specified for the corresponding type parameter of the current generic type. -or- contains an element that is a pointer type ( returns true), a by-ref type ( returns true), or . The invoked method is not supported in the base class. Derived classes must provide an implementation.
public MakeGenericType ( ) : Type
return Type

ToString() public method

public ToString ( ) : string
return string

Type() public method

public Type ( string name, Attribute attributes ) : System.Collections.Generic
name string
attributes Attribute
return System.Collections.Generic

_GetTypeFromTypeFunc() public static method

public static _GetTypeFromTypeFunc ( JsTypeFunction typeFunction ) : Type
typeFunction JsTypeFunction
return Type

Property Details

DefaultBinder public_oe static_oe property

public static Binder DefaultBinder
return Binder

EmptyTypes public_oe static_oe property

public static Type[] EmptyTypes
return Type[]