TypesExtensions Methods

Simple Injector

The TypesExtensions type exposes the following members.

Methods

  NameDescription
Public methodStatic memberGetClosedTypeOf
Gets the single closed version of genericTypeDefinition that the current type is assignable from. In case none or multiple matching closed types are found, and exception is thrown. Example: When type is a type class X : IX<int>, IFoo<string> and genericTypeDefinition is type IX<T>: this method will return type IX<int>.
Public methodStatic memberGetClosedTypesOf
Gets the list of closed versions of genericTypeDefinition that the current type is assignable from. Example: When type is a type class X : IX<int>, IFoo<string> and genericTypeDefinition is type IX<T>: this method will return type IX<int>.
Public methodStatic memberIsClosedTypeOf
Returns true is there is a closed version of the supplied genericTypeDefinition that is assignable from the current type. This method returns true when either type itself, one of its base classes or one of its implemented interfaces is a closed version of genericTypeDefinition; otherwise false.
Public methodStatic memberToFriendlyName
Builds an easy to read type name. Namespaces will be omitted, and generic types will be displayed in a C#-like syntax. Ideal for reporting type names in exception messages.
Top
See Also

Reference