閱讀英文版本 編輯

分享方式:


ScopingExtensions.Imports Method

Definition

Determines whether the specified part imports the specified contract.

Overloads

Imports(ComposablePartDefinition, String)

Determines whether the specified part imports the specified contract.

Imports(ComposablePartDefinition, String, ImportCardinality)

Determines whether the specified part imports the specified contract with the specified cardinality.

Imports(ComposablePartDefinition, String)

Source:
ScopingExtensions.cs
Source:
ScopingExtensions.cs
Source:
ScopingExtensions.cs

Determines whether the specified part imports the specified contract.

C#
public static bool Imports(this System.ComponentModel.Composition.Primitives.ComposablePartDefinition part, string contractName);

Parameters

part
ComposablePartDefinition

The part to search.

contractName
String

The name of the contract.

Returns

true if part imports the specified contract; otherwise, false.

Applies to

.NET 10 (package-provided) 和其他版本
產品 版本
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)

Imports(ComposablePartDefinition, String, ImportCardinality)

Source:
ScopingExtensions.cs
Source:
ScopingExtensions.cs
Source:
ScopingExtensions.cs

Determines whether the specified part imports the specified contract with the specified cardinality.

C#
public static bool Imports(this System.ComponentModel.Composition.Primitives.ComposablePartDefinition part, string contractName, System.ComponentModel.Composition.Primitives.ImportCardinality importCardinality);

Parameters

part
ComposablePartDefinition

The part to search.

contractName
String

The name of the contract.

importCardinality
ImportCardinality

The cardinality of the contract.

Returns

true if part imports a contract that has the specified name and cardinality; otherwise, false.

Applies to

.NET 10 (package-provided) 和其他版本
產品 版本
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)