Aracılığıyla paylaş


DependencyAccessor.TryResolveOptionalDependency Method

Definition

Resolves an optional dependency on one implementation of a contract.

public:
 bool TryResolveOptionalDependency(System::Object ^ site, System::Composition::Hosting::Core::CompositionContract ^ contract, bool isPrerequisite, [Runtime::InteropServices::Out] System::Composition::Hosting::Core::CompositionDependency ^ % dependency);
public bool TryResolveOptionalDependency (object site, System.Composition.Hosting.Core.CompositionContract contract, bool isPrerequisite, out System.Composition.Hosting.Core.CompositionDependency dependency);
member this.TryResolveOptionalDependency : obj * System.Composition.Hosting.Core.CompositionContract * bool * CompositionDependency -> bool
Public Function TryResolveOptionalDependency (site As Object, contract As CompositionContract, isPrerequisite As Boolean, ByRef dependency As CompositionDependency) As Boolean

Parameters

site
Object

A tag that describes the dependency site.

contract
CompositionContract

The contract required by the site.

isPrerequisite
Boolean

true to indicate that the dependency must be satisfied before exports are made available; otherwise, false.

dependency
CompositionDependency

After this method returns, contains the resolved dependency or null.

Returns

true if the dependency was resolved; otherwise, false.

Applies to