C# 클래스 WebApplications.Utilities.Reflect.ExtendedType

파일 보기 프로젝트 열기: webappsuk/CoreLibraries 1 사용 예제들

Private Properties

프로퍼티 타입 설명
Get ExtendedType
Get ExtendedType
GetCastFromMethod CastMethod
GetCastToMethod CastMethod
LoadMembers void

공개 메소드들

메소드 설명
CanConvertTo ( Type type ) : bool

Determines whether this instance can be converted to the specified type. Unlike the built in cast system, this returns true if a cast is possible AND if IConvertible can be used.

CloseType ( ) : ExtendedType

Closes the type if it is generic and has generic parameters, or creates equivalent type.

DescendsFrom ( [ baseType ) : bool

Checks to see if a type descends from another type.

ExtendedType ( [ type ) : System

Initializes a new instance of the ExtendedType class.

FindType ( [ typeName, bool throwOnError = false, bool ignoreCase = false ) : Type

Finds the type with the specified typeName.

This is more robust than using Type.GetType(string,bool,bool) as it supports partial assembly names.

GetConstructor ( ) : Constructor

Gets the constructor.

GetConstructor ( [ constructorInfo, bool includeBase = true ) : Constructor

Gets the Constructor matching the ConstructorInfo (if any).

GetConstructor ( bool includeBase ) : Constructor

Gets the constructor.

GetConstructor ( bool &castsRequired, bool includeBase ) : Constructor

Gets the constructor.

GetEvent ( [ name, bool includeBase = true ) : Event

Gets the event.

GetField ( [ name, bool includeBase = true ) : Field

Gets the field.

GetIndexer ( ) : Indexer

Gets the indexer from the type (or base types).

GetIndexer ( [ propertyInfo, bool includeBase = true ) : Indexer

Gets the Indexer matching the PropertyInfo (if any).

GetIndexer ( bool &castsRequired ) : Indexer

Gets the indexer from the type (or base types).

GetIndexer ( bool includeBase, bool &castsRequired ) : Indexer

Gets the indexer.

GetMethod ( [ name ) : Method

Gets the method.

GetMethod ( [ methodInfo, bool includeBase = true ) : Method

Gets the Method matching the MethodInfo (if any).

GetMethod ( [ name, int genericArguments ) : Method

Gets the method.

GetMethod ( [ name, int genericArguments, bool includeBase ) : Method

Gets the method.

GetMethod ( [ name, int genericArguments, bool allowClosure, bool allowCasts ) : Method

Gets the method.

GetMethod ( [ name, int genericArguments, bool allowClosure, bool allowCasts, bool includeBase ) : Method

Gets the method.

GetMethod ( [ name, int genericArguments, bool allowClosure, bool allowCasts, bool &castsRequired, bool includeBase ) : Method

Gets the method.

GetMethods ( [ name, bool includeBase = true ) : IEnumerable

Gets the methods.

GetProperty ( [ name, bool includeBase = true ) : System.Property

Gets the property.

Implements ( [ interfaceType ) : bool

Checks to see if this type implements a particular interface.

ImplementsCastFrom ( [ fromType, bool implicitOnly = true ) : bool

Whether this type implements a cast from the specified type.

ImplementsCastTo ( [ toType, bool implicitOnly = true ) : bool

Whether this type implements a cast to the specified type.

TryConvert ( [ expression, [ outputExpression ) : bool

Converts the specified expression to the output type.

This version is more powerful than the Expression.Convert CLR method in that it supports ToString() conversion, IConvertible and TypeConverters. It also prevents exceptions being thrown.

비공개 메소드들

메소드 설명
Get ( [ type ) : ExtendedType
Get ( [ typeName, bool ignoreCase = false ) : ExtendedType
GetCastFromMethod ( [ fromType ) : CastMethod
GetCastToMethod ( [ toType ) : CastMethod
LoadMembers ( ) : void

Loads all the members in one go.

메소드 상세

CanConvertTo() 공개 메소드

Determines whether this instance can be converted to the specified type. Unlike the built in cast system, this returns true if a cast is possible AND if IConvertible can be used.
public CanConvertTo ( Type type ) : bool
type System.Type The type.
리턴 bool

CloseType() 공개 메소드

Closes the type if it is generic and has generic parameters, or creates equivalent type.
public CloseType ( ) : ExtendedType
리턴 ExtendedType

DescendsFrom() 공개 메소드

Checks to see if a type descends from another type.
public DescendsFrom ( [ baseType ) : bool
baseType [ Type of the base.
리턴 bool

ExtendedType() 공개 메소드

Initializes a new instance of the ExtendedType class.
public ExtendedType ( [ type ) : System
type [ The type.
리턴 System

FindType() 공개 정적인 메소드

Finds the type with the specified typeName.
This is more robust than using Type.GetType(string,bool,bool) as it supports partial assembly names.
public static FindType ( [ typeName, bool throwOnError = false, bool ignoreCase = false ) : Type
typeName [ Name of the type.
throwOnError bool Throws an error if and not found.
ignoreCase bool Ignores the case if .
리턴 System.Type

GetConstructor() 공개 메소드

Gets the constructor.
public GetConstructor ( ) : Constructor
리턴 Constructor

GetConstructor() 공개 메소드

Gets the Constructor matching the ConstructorInfo (if any).
public GetConstructor ( [ constructorInfo, bool includeBase = true ) : Constructor
constructorInfo [ The constructor info.
includeBase bool if set to includes constructors from the base type.
리턴 Constructor

GetConstructor() 공개 메소드

Gets the constructor.
public GetConstructor ( bool includeBase ) : Constructor
includeBase bool if set to includes constructors from the base type.
리턴 Constructor

GetConstructor() 공개 메소드

Gets the constructor.
public GetConstructor ( bool &castsRequired, bool includeBase ) : Constructor
castsRequired bool Any array indicating which parameters require a cast (the last element is for the return type).
includeBase bool if set to includes constructors from the base type.
리턴 Constructor

GetEvent() 공개 메소드

Gets the event.
public GetEvent ( [ name, bool includeBase = true ) : Event
name [ The name.
includeBase bool if set to includes events from the base type.
리턴 Event

GetField() 공개 메소드

Gets the field.
public GetField ( [ name, bool includeBase = true ) : Field
name [ The name.
includeBase bool if set to includes fields from the base type.
리턴 Field

GetIndexer() 공개 메소드

Gets the indexer from the type (or base types).
public GetIndexer ( ) : Indexer
리턴 Indexer

GetIndexer() 공개 메소드

Gets the Indexer matching the PropertyInfo (if any).
public GetIndexer ( [ propertyInfo, bool includeBase = true ) : Indexer
propertyInfo [ The property info.
includeBase bool if set to includes indexers from the base type.
리턴 Indexer

GetIndexer() 공개 메소드

Gets the indexer from the type (or base types).
public GetIndexer ( bool &castsRequired ) : Indexer
castsRequired bool Any array indicating which parameters require a cast (the last element is for the return type).
리턴 Indexer

GetIndexer() 공개 메소드

Gets the indexer.
public GetIndexer ( bool includeBase, bool &castsRequired ) : Indexer
includeBase bool if set to includes indexers from the base type.
castsRequired bool Any array indicating which parameters require a cast (the last element is for the return type).
리턴 Indexer

GetMethod() 공개 메소드

Gets the method.
public GetMethod ( [ name ) : Method
name [ The name.
리턴 Method

GetMethod() 공개 메소드

Gets the Method matching the MethodInfo (if any).
public GetMethod ( [ methodInfo, bool includeBase = true ) : Method
methodInfo [ The method info.
includeBase bool if set to includes methods from the base type.
리턴 Method

GetMethod() 공개 메소드

Gets the method.
public GetMethod ( [ name, int genericArguments ) : Method
name [ The name.
genericArguments int The number of generic arguments.
리턴 Method

GetMethod() 공개 메소드

Gets the method.
public GetMethod ( [ name, int genericArguments, bool includeBase ) : Method
name [ The name.
genericArguments int The number of generic arguments.
includeBase bool if set to includes methods from the base type.
리턴 Method

GetMethod() 공개 메소드

Gets the method.
public GetMethod ( [ name, int genericArguments, bool allowClosure, bool allowCasts ) : Method
name [ The name.
genericArguments int The number of generic arguments.
allowClosure bool if set to will automatically close the signatures generic types if possible.
allowCasts bool if set to then types will match if they can be cast to the required type.
리턴 Method

GetMethod() 공개 메소드

Gets the method.
public GetMethod ( [ name, int genericArguments, bool allowClosure, bool allowCasts, bool includeBase ) : Method
name [ The name.
genericArguments int The number of generic arguments.
allowClosure bool if set to will automatically close the signatures generic types if possible.
allowCasts bool if set to then types will match if they can be cast to the required type.
includeBase bool if set to includes methods from the base type.
리턴 Method

GetMethod() 공개 메소드

Gets the method.
public GetMethod ( [ name, int genericArguments, bool allowClosure, bool allowCasts, bool &castsRequired, bool includeBase ) : Method
name [ The name.
genericArguments int The number of generic arguments.
allowClosure bool if set to will automatically close the signatures generic types if possible.
allowCasts bool if set to then types will match if they can be cast to the required type.
castsRequired bool Any array indicating which parameters require a cast (the last element is for the return type).
includeBase bool if set to includes methods from the base type.
리턴 Method

GetMethods() 공개 메소드

Gets the methods.
public GetMethods ( [ name, bool includeBase = true ) : IEnumerable
name [ The name.
includeBase bool if set to includes methods from the base type.
리턴 IEnumerable

GetProperty() 공개 메소드

Gets the property.
public GetProperty ( [ name, bool includeBase = true ) : System.Property
name [ The name.
includeBase bool if set to includes properties from the base type.
리턴 System.Property

Implements() 공개 메소드

Checks to see if this type implements a particular interface.
public Implements ( [ interfaceType ) : bool
interfaceType [ Type of the interface.
리턴 bool

ImplementsCastFrom() 공개 메소드

Whether this type implements a cast from the specified type.
public ImplementsCastFrom ( [ fromType, bool implicitOnly = true ) : bool
fromType [ The type to cast from.
implicitOnly bool If set to only allows implicit casts.
리턴 bool

ImplementsCastTo() 공개 메소드

Whether this type implements a cast to the specified type.
public ImplementsCastTo ( [ toType, bool implicitOnly = true ) : bool
toType [ The type to cast to.
implicitOnly bool If set to only allows implicit casts.
리턴 bool

TryConvert() 공개 메소드

Converts the specified expression to the output type.
This version is more powerful than the Expression.Convert CLR method in that it supports ToString() conversion, IConvertible and TypeConverters. It also prevents exceptions being thrown.
public TryConvert ( [ expression, [ outputExpression ) : bool
expression [ The expression.
outputExpression [ The output expression.
리턴 bool