Useful extensions on Type.
Inheritance Hierarchy
SimpleInjectorTypesExtensions
Namespace: SimpleInjector
Assembly: SimpleInjector (in SimpleInjector.dll) Version: 5.3.0
Syntax
The TypesExtensions type exposes the following members.
Methods
Name | Description | |
---|---|---|
GetClosedTypeOf |
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>.
| |
GetClosedTypesOf |
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>.
| |
IsClosedTypeOf |
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.
| |
ToFriendlyName |
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.
|
See Also