C# Class FullInspector.Internal.fiTypeExtensions

Extensions to the Type API.
Mostrar archivo Open project: jacobdufault/fullinspector

Public Methods

Method Description
GetInterface ( this type, Type interfaceType ) : Type

Searches for a particular implementation of the given interface 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.

HasParent ( this type, Type parentType ) : bool

Searches for a particular implementation of the given 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.

IsImplementationOf ( this type, Type interfaceType ) : bool

Returns true if the baseType is an implementation of the given interface type. The interface type can be generic.

IsNullableType ( this type ) : bool

Returns true if the given type is nullable.

This *should* always return false if the type was fetched via GetType() according to the .NET docs at http://msdn.microsoft.com/en-us/library/ms366789.aspx.

Private Methods

Method Description
CompareTypes ( Type a, Type b ) : bool

Method Details

GetInterface() public static method

Searches for a particular implementation of the given interface 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 GetInterface ( this type, Type interfaceType ) : Type
type this The base type to search for interface
interfaceType System.Type /// The interface type to search for. Can be an open generic type. ///
return System.Type

HasParent() public static method

Searches for a particular implementation of the given 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 HasParent ( this type, Type parentType ) : bool
type this The base type to search for interface
parentType System.Type /// The interface type to search for. Can be an open generic type. ///
return bool

IsImplementationOf() public static method

Returns true if the baseType is an implementation of the given interface type. The interface type can be generic.
public static IsImplementationOf ( this type, Type interfaceType ) : bool
type this /// The type to search for an implementation of the given interface ///
interfaceType System.Type The interface type to search for
return bool

IsNullableType() public static method

Returns true if the given type is nullable.
This *should* always return false if the type was fetched via GetType() according to the .NET docs at http://msdn.microsoft.com/en-us/library/ms366789.aspx.
public static IsNullableType ( this type ) : bool
type this
return bool