共用方式為


AddInToken.QualificationData 屬性

定義

取得與目前語彙基元關聯之管線中區段相關資料的字典。

public:
 property System::Collections::Generic::IDictionary<System::AddIn::Hosting::AddInSegmentType, System::Collections::Generic::IDictionary<System::String ^, System::String ^> ^> ^ QualificationData { System::Collections::Generic::IDictionary<System::AddIn::Hosting::AddInSegmentType, System::Collections::Generic::IDictionary<System::String ^, System::String ^> ^> ^ get(); };
public System.Collections.Generic.IDictionary<System.AddIn.Hosting.AddInSegmentType,System.Collections.Generic.IDictionary<string,string>> QualificationData { get; }
member this.QualificationData : System.Collections.Generic.IDictionary<System.AddIn.Hosting.AddInSegmentType, System.Collections.Generic.IDictionary<string, string>>
Public ReadOnly Property QualificationData As IDictionary(Of AddInSegmentType, IDictionary(Of String, String))

屬性值

字典,其索引鍵為管線區段,其值為表示每個區段限定性條件資料之名稱/值組的字典。

範例

下列範例示範如何檢查載入宏的資格數據。

// Use qualification data to control
// how an add-in should be activated.

if (selectedToken.QualificationData[AddInSegmentType.AddIn]["Isolation"].Equals("NewProcess"))
{
    // Create an external process.
    AddInProcess external = new AddInProcess();

    // Activate an add-in in the new process
    // with the full trust security level.
    Calculator CalcAddIn5 =
        selectedToken.Activate<Calculator>(external,
        AddInSecurityLevel.FullTrust);
    Console.WriteLine("Add-in activated per qualification data.");
}
else
{
    Console.WriteLine("This add-in is not designated to be activated in a new process.");
}
' Use qualification data to control
' how an add-in should be activated.

If selectedToken.QualificationData(AddInSegmentType.AddIn)("Isolation").Equals("NewProcess") Then
    ' Create an external process.
    Dim external As AddInProcess = New AddInProcess

    ' Activate an add-in in an automatically generated
    ' application domain with a full trust security level.
    Dim CalcAddin5 As Calculator = _
        selectedToken.Activate(Of Calculator)(external, _
            AddInSecurityLevel.FullTrust)
    Console.WriteLine("Add-in activated per qualification data.")
Else
    Console.WriteLine("This add-in is not designated to be activated in a new process.")
End If

備註

使用這個屬性取得已套用至具有 屬性之 QualificationDataAttribute 管線區段的數據。 您可以使用此資料來識別及處理撰寫管線的類型。

這個屬性會傳回字典。 頂端字典一律有六個索引鍵。 每個索引鍵都是 AddInSegmentType 管線中區段的值。 每個值都是字串的泛型 IDictionary<TKey,TValue> ,其中包含區段的限定性數據。

這些內部字典的索引鍵和值是區段屬性中指定的 QualificationDataAttribute 名稱和值。 如果未將限定性數據套用至區段,則其字典是空的。

注意

載入宏模型不會使用套用至載入宏主機檢視的限定性數據。 因此,的 AddInSegmentType.HostViewOfAddIn 字典一律是空的。

或者,您可以使用 Visual C++ 中 Visual for each C++) 的 (For Each 語句,列舉 AddInToken 結構集合QualificationDataItemforeach,以取得限定性數據。 請參閱針對 QualificationDataItem 結構提供的範例。

適用於