CompositionContext.GetExport Method

Definition

Overloads

GetExport(CompositionContract)

Retrieves the export that matches the specified contract.

GetExport(Type)

Retrieves the export that matches the specified type.

GetExport(Type, String)

Retrieves the export that matches the specified name and type.

GetExport<TExport>()

Retrieves the export that matches the specified generic type parameter.

GetExport<TExport>(String)

Retrieves the export that matches the specified generic type parameter and contract name.

GetExport(CompositionContract)

Source:
CompositionContext.cs
Source:
CompositionContext.cs

Retrieves the export that matches the specified contract.

public object GetExport (System.Composition.Hosting.Core.CompositionContract contract);

Parameters

contract
CompositionContract

The contract to match.

Returns

The exported value.

Exceptions

No export was found for contract.

Applies to

.NET 9 (package-provided) e outras versões
Produto Versões
.NET Core 1.1, 6 (package-provided), 7 (package-provided), 8 (package-provided), 9 (package-provided)
.NET Framework 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided)
.NET Standard 2.0 (package-provided)

GetExport(Type)

Source:
CompositionContext.cs
Source:
CompositionContext.cs

Retrieves the export that matches the specified type.

public object GetExport (Type exportType);

Parameters

exportType
Type

The type to match.

Returns

The exported value.

Exceptions

No export was found for exportType.

Applies to

.NET 9 (package-provided) e outras versões
Produto Versões
.NET Core 1.1, 6 (package-provided), 7 (package-provided), 8 (package-provided), 9 (package-provided)
.NET Framework 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided)
.NET Standard 2.0 (package-provided)

GetExport(Type, String)

Source:
CompositionContext.cs
Source:
CompositionContext.cs

Retrieves the export that matches the specified name and type.

public object GetExport (Type exportType, string contractName);

Parameters

exportType
Type

The type to match.

contractName
String

The name to match.

Returns

The exported value.

Exceptions

No export was found for exportType and contractName.

Applies to

.NET 9 (package-provided) e outras versões
Produto Versões
.NET Core 1.1, 6 (package-provided), 7 (package-provided), 8 (package-provided), 9 (package-provided)
.NET Framework 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided)
.NET Standard 2.0 (package-provided)

GetExport<TExport>()

Source:
CompositionContext.cs
Source:
CompositionContext.cs

Retrieves the export that matches the specified generic type parameter.

public TExport GetExport<TExport> ();

Type Parameters

TExport

The type to match.

Returns

TExport

The exported value.

Exceptions

No export was found for TExport.

Applies to

.NET 9 (package-provided) e outras versões
Produto Versões
.NET Core 1.1, 6 (package-provided), 7 (package-provided), 8 (package-provided), 9 (package-provided)
.NET Framework 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided)
.NET Standard 2.0 (package-provided)

GetExport<TExport>(String)

Source:
CompositionContext.cs
Source:
CompositionContext.cs

Retrieves the export that matches the specified generic type parameter and contract name.

public TExport GetExport<TExport> (string contractName);

Type Parameters

TExport

The type to match.

Parameters

contractName
String

The name to match.

Returns

TExport

The exported value.

Exceptions

No export was found for TExport and contractName.

Applies to

.NET 9 (package-provided) e outras versões
Produto Versões
.NET Core 1.1, 6 (package-provided), 7 (package-provided), 8 (package-provided), 9 (package-provided)
.NET Framework 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided)
.NET Standard 2.0 (package-provided)