C# Class GSF.TypeExtensions

Extensions to all Type objects.
Show file Open project: GridProtectionAlliance/gsf

Public Methods

Method Description
GetFriendlyClassName ( this type ) : string

Gets the friendly class name of the provided type, trimming generic parameters.

GetRootType ( this type ) : Type

Gets the root type in the inheritance hierarchy from which the specified type inherits.

Unless input type is object or MarshalByRefObject, the returned type will never be object or MarshalByRefObject, even though all types ultimately inherit from either one of them.

IsNumeric ( this type ) : bool

Determines if the specified type is a native structure that represents a numeric value.

For this method a boolean value is not considered numeric even though it can be thought of as a bit. This expression returns true if the type is one of the following:

SByte, Byte, Int16, UInt16, Int24, UInt24, Int32, UInt32, Int64, UInt64, Single, Double, Decimal

LoadImplementations ( this type ) : List

Loads public types from assemblies in the application binaries directory that implement the specified type either through class inheritance or interface implementation.

LoadImplementations ( this type, bool excludeAbstractTypes ) : List

Loads public types from assemblies in the application binaries directory that implement the specified type either through class inheritance or interface implementation.

LoadImplementations ( this type, string binariesDirectory ) : List

Loads public types from assemblies in the specified binariesDirectory that implement the specified type either through class inheritance or interface implementation.

Private Methods

Method Description
LoadImplementations ( this type, string binariesDirectory, bool excludeAbstractTypes, bool validateReferences = true ) : List

Method Details

GetFriendlyClassName() public static method

Gets the friendly class name of the provided type, trimming generic parameters.
public static GetFriendlyClassName ( this type ) : string
type this Type to get friendly class name for.
return string

GetRootType() public static method

Gets the root type in the inheritance hierarchy from which the specified type inherits.
Unless input type is object or MarshalByRefObject, the returned type will never be object or MarshalByRefObject, even though all types ultimately inherit from either one of them.
public static GetRootType ( this type ) : Type
type this The whose root type is to be found.
return System.Type

IsNumeric() public static method

Determines if the specified type is a native structure that represents a numeric value.
For this method a boolean value is not considered numeric even though it can be thought of as a bit. This expression returns true if the type is one of the following:

SByte, Byte, Int16, UInt16, Int24, UInt24, Int32, UInt32, Int64, UInt64, Single, Double, Decimal
public static IsNumeric ( this type ) : bool
type this The being tested.
return bool

LoadImplementations() public static method

Loads public types from assemblies in the application binaries directory that implement the specified type either through class inheritance or interface implementation.
public static LoadImplementations ( this type ) : List
type this The that must be implemented by the public types.
return List

LoadImplementations() public static method

Loads public types from assemblies in the application binaries directory that implement the specified type either through class inheritance or interface implementation.
public static LoadImplementations ( this type, bool excludeAbstractTypes ) : List
type this The that must be implemented by the public types.
excludeAbstractTypes bool true to exclude public types that are abstract; otherwise false.
return List

LoadImplementations() public static method

Loads public types from assemblies in the specified binariesDirectory that implement the specified type either through class inheritance or interface implementation.
public static LoadImplementations ( this type, string binariesDirectory ) : List
type this The that must be implemented by the public types.
binariesDirectory string The directory containing the assemblies to be processed.
return List