อ่านในภาษาอังกฤษ

แชร์ผ่าน


DependencyAccessor.TryResolveOptionalDependency Method

Definition

Resolves an optional dependency on one implementation of a contract.

public bool TryResolveOptionalDependency (object site, System.Composition.Hosting.Core.CompositionContract contract, bool isPrerequisite, out System.Composition.Hosting.Core.CompositionDependency dependency);

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

ผลิตภัณฑ์ เวอร์ชัน
.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)