ExportProvider.GetExportedValue ExportProvider.GetExportedValue ExportProvider.GetExportedValue ExportProvider.GetExportedValue Method

Definition

Gets an exported object.

Overloads

GetExportedValue<T>() GetExportedValue<T>() GetExportedValue<T>() GetExportedValue<T>()

Returns the exported object with the contract name derived from the specified type parameter. If there is not exactly one matching exported object, an exception is thrown.

GetExportedValue<T>(String) GetExportedValue<T>(String) GetExportedValue<T>(String) GetExportedValue<T>(String)

Returns the exported object with the specified contract name. If there is not exactly one matching exported object, an exception is thrown.

GetExportedValue<T>() GetExportedValue<T>() GetExportedValue<T>() GetExportedValue<T>()

Returns the exported object with the contract name derived from the specified type parameter. If there is not exactly one matching exported object, an exception is thrown.

public:
generic <typename T>
 T GetExportedValue();
public T GetExportedValue<T> ();
member this.GetExportedValue : unit -> 'T
Public Function GetExportedValue(Of T) () As T

Type Parameters

T

The type of the exported object to return. The contract name is also derived from this type parameter.

Returns

T T T T

The exported object with the contract name derived from the specified type parameter.

Exceptions

There are zero exported objects with the contract name derived from T in the CompositionContainer.

-or-

There is more than one exported object with the contract name derived from T in the CompositionContainer.

An error occurred during composition. Errors will contain a collection of errors that occurred.

Remarks

The contract name is the result of calling the GetContractName method on T.

The contract name is compared by using the Ordinal property to perform a case-sensitive, non-linguistic comparison.

GetExportedValue<T>(String) GetExportedValue<T>(String) GetExportedValue<T>(String) GetExportedValue<T>(String)

Returns the exported object with the specified contract name. If there is not exactly one matching exported object, an exception is thrown.

public:
generic <typename T>
 T GetExportedValue(System::String ^ contractName);
public T GetExportedValue<T> (string contractName);
member this.GetExportedValue : string -> 'T
Public Function GetExportedValue(Of T) (contractName As String) As T

Type Parameters

T

The type of the exported object to return.

Parameters

contractName
String String String String

The contract name of the exported object to return, or null or an empty string ("") to use the default contract name.

Returns

T T T T

The exported object with the specified contract name.

Exceptions

There are zero exported objects with the contract name derived from T in the CompositionContainer.

-or-

There is more than one exported object with the contract name derived from T in the CompositionContainer.

An error occurred during composition. Errors will contain a collection of errors that occurred.

Remarks

The default contract name is the result of calling the GetContractName method on T.

The contract name is compared by using the Ordinal property to perform a case-sensitive, non-linguistic comparison.

Applies to