C# Class FullInspector.Internal.fiReflectionUtility

Mostra file Open project: jacobdufault/fullinspector

Public Methods

Method Description
GetCreatableTypesDeriving ( Type baseType ) : List

Returns all types that derive from the base type. This includes generic type definitions, which when returned will have appropriate constructor values injected.

GetExactImplementation ( this type, Type parentType ) : Type

Searches for a particular implementation of the given parent type inside of the type. This is particularly useful if the interface type is an open type, ie, typeof(IFace{}), because this method will then return IFace{} but with appropriate type parameters inserted.

GetObjectTypeNameSafe ( object obj ) : string

Tries to fetch the given CSharpName of the given object type, or null if the object is null.

GetTypesDeriving ( Type baseType ) : List

Private Methods

Method Description
GetIndexOfName ( Type types, string name ) : int

Helper method to return the index of the Type in the array that has the given Name (or - 1 if the item is not in the array).

SelectBestTypeParameters ( List candidateTypes, Type openGenericType ) : System.Type[]

Orders the given types parameter array so that the order most closely matches the given genericArguments array

TryConstructAssignableGenericType ( Type openGenericType, Type baseType, Type baseTypeGenericDefinition, Type baseTypeGenericArguments, Type &constructedType ) : bool

Attempts to create an instance of openGenericType such that it is can be assigned to baseType.

fiReflectionUtility ( ) : System

Method Details

GetCreatableTypesDeriving() public static method

Returns all types that derive from the base type. This includes generic type definitions, which when returned will have appropriate constructor values injected.
public static GetCreatableTypesDeriving ( Type baseType ) : List
baseType System.Type The base parent type.
return List

GetExactImplementation() public static method

Searches for a particular implementation of the given parent type inside of the type. This is particularly useful if the interface type is an open type, ie, typeof(IFace{}), because this method will then return IFace{} but with appropriate type parameters inserted.
public static GetExactImplementation ( this type, Type parentType ) : Type
type this The base type to search for interface
parentType System.Type /// The parent type to search for. Can be an open generic type. ///
return System.Type

GetObjectTypeNameSafe() public static method

Tries to fetch the given CSharpName of the given object type, or null if the object is null.
public static GetObjectTypeNameSafe ( object obj ) : string
obj object
return string

GetTypesDeriving() public static method

public static GetTypesDeriving ( Type baseType ) : List
baseType System.Type
return List