Partager via


CompositionContext.TryGetExport Method

Definition

Overloads

TryGetExport(CompositionContract, Object)

Returns the export that matches the specified contract, or returns null if no match is found.

TryGetExport(Type, Object)

Returns the export that matches the specified type, or returns null if no match is found.

TryGetExport(Type, String, Object)

Returns the export that matches the specified contract name and type, or returns null if no match is found.

TryGetExport<TExport>(TExport)

Returns the export that matches the specified generic type parameter, or returns null if no match is found.

TryGetExport<TExport>(String, TExport)

Returns the export that matches the specified generic type parameter and contract name, or returns null if no match is found.

TryGetExport(CompositionContract, Object)

Source:
CompositionContext.cs
Source:
CompositionContext.cs

Returns the export that matches the specified contract, or returns null if no match is found.

public:
 abstract bool TryGetExport(System::Composition::Hosting::Core::CompositionContract ^ contract, [Runtime::InteropServices::Out] System::Object ^ % export);
public abstract bool TryGetExport (System.Composition.Hosting.Core.CompositionContract contract, out object export);
abstract member TryGetExport : System.Composition.Hosting.Core.CompositionContract * obj -> bool
Public MustOverride Function TryGetExport (contract As CompositionContract, ByRef export As Object) As Boolean

Parameters

contract
CompositionContract

The contract to match.

export
Object

When this method returns, contains the matched export or null.

Returns

true if an export was found; otherwise, false.

Exceptions

No export was found for contract.

Applies to

TryGetExport(Type, Object)

Source:
CompositionContext.cs
Source:
CompositionContext.cs

Returns the export that matches the specified type, or returns null if no match is found.

public:
 bool TryGetExport(Type ^ exportType, [Runtime::InteropServices::Out] System::Object ^ % export);
public bool TryGetExport (Type exportType, out object export);
member this.TryGetExport : Type * obj -> bool
Public Function TryGetExport (exportType As Type, ByRef export As Object) As Boolean

Parameters

exportType
Type

The type to match.

export
Object

When this method returns, contains the matched export or null.

Returns

true if an export was found; otherwise, false.

Exceptions

No export was found for contract.

Applies to

TryGetExport(Type, String, Object)

Source:
CompositionContext.cs
Source:
CompositionContext.cs

Returns the export that matches the specified contract name and type, or returns null if no match is found.

public:
 bool TryGetExport(Type ^ exportType, System::String ^ contractName, [Runtime::InteropServices::Out] System::Object ^ % export);
public bool TryGetExport (Type exportType, string contractName, out object export);
member this.TryGetExport : Type * string * obj -> bool
Public Function TryGetExport (exportType As Type, contractName As String, ByRef export As Object) As Boolean

Parameters

exportType
Type

The type to match.

contractName
String

The name to match.

export
Object

When this method returns, contains the matched export or null.

Returns

true if an export was found; otherwise, false.

Exceptions

No export was found for contract.

Applies to

TryGetExport<TExport>(TExport)

Source:
CompositionContext.cs
Source:
CompositionContext.cs

Returns the export that matches the specified generic type parameter, or returns null if no match is found.

public:
generic <typename TExport>
 bool TryGetExport([Runtime::InteropServices::Out] TExport % export);
public bool TryGetExport<TExport> (out TExport export);
member this.TryGetExport : 'Export -> bool
Public Function TryGetExport(Of TExport) (ByRef export As TExport) As Boolean

Type Parameters

TExport

The type to match.

Parameters

export
TExport

When this method returns, contains the matched export or null.

Returns

true if an export was found; otherwise, false.

Exceptions

No export was found for contract.

Applies to

TryGetExport<TExport>(String, TExport)

Source:
CompositionContext.cs
Source:
CompositionContext.cs

Returns the export that matches the specified generic type parameter and contract name, or returns null if no match is found.

public:
generic <typename TExport>
 bool TryGetExport(System::String ^ contractName, [Runtime::InteropServices::Out] TExport % export);
public bool TryGetExport<TExport> (string contractName, out TExport export);
member this.TryGetExport : string * 'Export -> bool
Public Function TryGetExport(Of TExport) (contractName As String, ByRef export As TExport) As Boolean

Type Parameters

TExport

The type to match.

Parameters

contractName
String

The name to match.

export
TExport

When this method returns, contains the matched export or null.

Returns

true if an export was found; otherwise, false.

Exceptions

No export was found for contract.

Applies to