ExportProvider.TryGetExports(ImportDefinition, AtomicComposition, IEnumerable<Export>) 方法

定義

取得符合指定之匯入條件的所有匯出。Gets all the exports that match the conditions of the specified import.

public:
 bool TryGetExports(System::ComponentModel::Composition::Primitives::ImportDefinition ^ definition, System::ComponentModel::Composition::Hosting::AtomicComposition ^ atomicComposition, [Runtime::InteropServices::Out] System::Collections::Generic::IEnumerable<System::ComponentModel::Composition::Primitives::Export ^> ^ % exports);
public bool TryGetExports (System.ComponentModel.Composition.Primitives.ImportDefinition definition, System.ComponentModel.Composition.Hosting.AtomicComposition atomicComposition, out System.Collections.Generic.IEnumerable<System.ComponentModel.Composition.Primitives.Export> exports);
member this.TryGetExports : System.ComponentModel.Composition.Primitives.ImportDefinition * System.ComponentModel.Composition.Hosting.AtomicComposition * seq -> bool

參數

definition
ImportDefinition

物件,此物件會定義要取得之 Export 物件的條件。The object that defines the conditions of the Export objects to get.

atomicComposition
AtomicComposition

用於撰寫的異動容器。The transactional container for the composition.

exports
IEnumerable<Export>

當此方法傳回時,包含符合 Export 定義條件的 ImportDefinition 物件集合 (如果有找到的話),否則,則為空的 IEnumerable<T> 物件。When this method returns, contains a collection of Export objects that match the conditions defined by ImportDefinition, if found; otherwise, an empty IEnumerable<T> object. 這個參數會以未初始化的狀態傳遞。This parameter is passed uninitialized.

傳回

CardinalityZeroOrOneZeroOrMore 且有零個 Export 物件符合指定 ImportDefinition 的條件,則為 true;若 CardinalityZeroOrOneExactlyOne 且有剛好一個 Export 符合指定 ImportDefinition 的條件,則為 true;否則為 falsetrue if Cardinality is ZeroOrOne or ZeroOrMore and there are zero Export objects that match the conditions of the specified ImportDefinition; true if Cardinality is ZeroOrOne or ExactlyOne and there is exactly one Export that matches the conditions of the specified ImportDefinition; otherwise, false.

例外狀況

definitionnulldefinition is null.

適用於