Upravit

Sdílet prostřednictvím


ExportProvider.GetExport Method

Definition

Gets a specified export.

Overloads

GetExport<T,TMetadataView>()

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

GetExport<T,TMetadataView>(String)

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

GetExport<T>()

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

GetExport<T>(String)

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

GetExport<T,TMetadataView>()

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

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

public:
generic <typename T, typename TMetadataView>
 Lazy<T, TMetadataView> ^ GetExport();
public Lazy<T,TMetadataView>? GetExport<T,TMetadataView> ();
public Lazy<T,TMetadataView> GetExport<T,TMetadataView> ();
member this.GetExport : unit -> Lazy<'T, 'MetadataView>
Public Function GetExport(Of T, TMetadataView) () As Lazy(Of T, TMetadataView)

Type Parameters

T

The type parameter of the Lazy<T,TMetadata> object to return. The contract name is also derived from this type parameter.

TMetadataView

The type of the metadata view of the Lazy<T,TMetadata> object to return.

Returns

Lazy<T,TMetadataView>

System.Lazy`2

Exceptions

There are zero Lazy<T,TMetadata> objects with the contract name derived from T in the CompositionContainer object.

-or-

There is more than one Lazy<T,TMetadata> object with the contract name derived from T in the CompositionContainer object.

The CompositionContainer object has been disposed of.

TMetadataView is not a valid metadata view type.

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

GetExport<T,TMetadataView>(String)

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

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

public:
generic <typename T, typename TMetadataView>
 Lazy<T, TMetadataView> ^ GetExport(System::String ^ contractName);
public Lazy<T,TMetadataView>? GetExport<T,TMetadataView> (string? contractName);
public Lazy<T,TMetadataView> GetExport<T,TMetadataView> (string contractName);
member this.GetExport : string -> Lazy<'T, 'MetadataView>
Public Function GetExport(Of T, TMetadataView) (contractName As String) As Lazy(Of T, TMetadataView)

Type Parameters

T

The type parameter of the Lazy<T,TMetadata> object to return.

TMetadataView

The type of the metadata view of the Lazy<T,TMetadata> object to return.

Parameters

contractName
String

The contract name of the Lazy<T,TMetadata> object to return, or null or an empty string ("") to use the default contract name.

Returns

Lazy<T,TMetadataView>

The export with the specified contract name.

Exceptions

There are zero Lazy<T,TMetadata> objects with the contract name derived from T in the CompositionContainer object.

-or-

There is more than one Lazy<T,TMetadata> object with the contract name derived from T in the CompositionContainer object.

The CompositionContainer object has been disposed of.

TMetadataView is not a valid metadata view type.

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

GetExport<T>()

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

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

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

Type Parameters

T

The type parameter of the Lazy<T> object to return. The contract name is also derived from this type parameter.

Returns

The export with the contract name derived from the specified type parameter.

Exceptions

There are zero Lazy<T> objects with the contract name derived from T in the CompositionContainer object.

-or-

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

The CompositionContainer object has been disposed of.

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

GetExport<T>(String)

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

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

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

Type Parameters

T

The type parameter of the Lazy<T> object to return.

Parameters

contractName
String

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

Returns

The export with the specified contract name.

Exceptions

There are zero Lazy<T> objects with the contract name derived from T in the CompositionContainer object.

-or-

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

The CompositionContainer object has been disposed of.

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