Click or drag to resize

ConfigurationExtensionsGetType Method

Loads a type by name.

Namespace:  Autofac.Configuration.Core
Assembly:  Autofac.Configuration (in Autofac.Configuration.dll) Version: 6.0.0+ec1c6438ceb3f3338c7364e35e7303f014e3fc39
public static Type GetType(
	this IConfiguration configuration,
	string key,
	Assembly defaultAssembly


Type: IConfiguration
The IConfiguration object containing the type value to load.
Type: SystemString
Name of the Type to load. This may be a partial type name or a fully-qualified type name.
Type: System.ReflectionAssembly
The default Assembly to use in type resolution if key is a partial type name.

Return Value

Type: Type
The resolved Type based on the specified name.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IConfiguration. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
ArgumentNullException Thrown if configuration is .
InvalidOperationException Thrown if the specified key can't be resolved as a fully-qualified type name and isn't a partial type name for a Type found in the defaultAssembly.
See Also