Muokkaa

Jaa


ExportProvider.GetExportedValues Method

Definition

Gets one or more exported objects.

Overloads

GetExportedValues<T>(String)

Gets all the exported objects with the specified contract name.

GetExportedValues<T>()

Gets all the exported objects with the contract name derived from the specified type parameter.

GetExportedValues<T>(String)

Source:
ExportProvider.GetExportOverrides.cs
Source:
ExportProvider.GetExportOverrides.cs
Source:
ExportProvider.GetExportOverrides.cs

Gets all the exported objects with the specified contract name.

public:
generic <typename T>
 System::Collections::Generic::IEnumerable<T> ^ GetExportedValues(System::String ^ contractName);
public System.Collections.Generic.IEnumerable<T> GetExportedValues<T> (string? contractName);
public System.Collections.Generic.IEnumerable<T> GetExportedValues<T> (string contractName);
member this.GetExportedValues : string -> seq<'T>
Public Function GetExportedValues(Of T) (contractName As String) As IEnumerable(Of T)

Type Parameters

T

The type of the exported object to return.

Parameters

contractName
String

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

Returns

The exported objects with the specified contract name, if found; otherwise, an empty Collection<T> object.

Exceptions

The CompositionContainer object has been disposed of.

One or more of the underlying exported values cannot be cast to T.

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

GetExportedValues<T>()

Source:
ExportProvider.GetExportOverrides.cs
Source:
ExportProvider.GetExportOverrides.cs
Source:
ExportProvider.GetExportOverrides.cs

Gets all the exported objects with the contract name derived from the specified type parameter.

public:
generic <typename T>
 System::Collections::Generic::IEnumerable<T> ^ GetExportedValues();
public System.Collections.Generic.IEnumerable<T> GetExportedValues<T> ();
member this.GetExportedValues : unit -> seq<'T>
Public Function GetExportedValues(Of T) () As IEnumerable(Of T)

Type Parameters

T

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

Returns

The exported objects with the contract name derived from the specified type parameter, if found; otherwise, an empty Collection<T> object.

Exceptions

The CompositionContainer object has been disposed of.

One or more of the underlying exported objects cannot be cast to T.

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.

Applies to