AddInToken.GetEnumerator 方法

定义

返回一个与此标记关联的管线段的限定数据枚举数。Returns an enumerator for the qualification data of the pipeline segments that are associated with this token.

public:
 virtual System::Collections::Generic::IEnumerator<System::AddIn::Hosting::QualificationDataItem> ^ GetEnumerator();
public System.Collections.Generic.IEnumerator<System.AddIn.Hosting.QualificationDataItem> GetEnumerator ();
abstract member GetEnumerator : unit -> System.Collections.Generic.IEnumerator<System.AddIn.Hosting.QualificationDataItem>
override this.GetEnumerator : unit -> System.Collections.Generic.IEnumerator<System.AddIn.Hosting.QualificationDataItem>
Public Function GetEnumerator () As IEnumerator(Of QualificationDataItem)

返回

一个枚举数,可用于循环访问与当前标记关联的管线段的限定数据。An enumerator that can be used to iterate through the qualification data of the pipeline segments that are associated with the current token.

实现

示例

下面的示例列出了与标记集合中的每个AddInToken关联的管道段的限定数据。The following example lists the qualification data for the pipeline segments associated with each AddInToken in a collection of tokens.

// Show the qualification data for each
// token in an AddInToken collection.
foreach (AddInToken token in tokens)
{
    foreach (QualificationDataItem qdi in token)
    {
        Console.WriteLine("{0} {1}\n\t QD Name: {2}, QD Value: {3}",
            token.Name,
            qdi.Segment, 
            qdi.Name, 
            qdi.Value);
    }
}

' Show the qualification data for each
' token in an AddInToken collection.
For Each token As AddInToken In tokens
    For Each qdi As QualificationDataItem In token
        Console.WriteLine("{0} {1}\n\t QD Name: {2}, QD Value: {3}", _
            token.Name, qdi.Segment, qdi.Name, qdi.Value)
    Next
Next

注解

使用此方法可以将令牌视为限定数据项的集合foreach , 例如, 在语句中 (For Each在 Visual Basic for each的视觉对象C++中)。Use this method to treat a token as if it were a collection of qualification data items, for example, in a foreach statement (For Each in Visual Basic, for each in Visual C++).

使用此方法返回的枚举器循环访问与当前标记关联的管线段的限定数据项。Use the enumerator returned by this method to iterate through the qualification data items of the pipeline segments associated with the current token. 每个限定数据项都是QualificationDataItem一个结构, 用于标识管道段, 并包含应用于该段的QualificationDataAttribute特性的名称/值对。Each item of qualification data is a QualificationDataItem structure that identifies the pipeline segment and contains a name/value pair from a QualificationDataAttribute attribute applied to that segment.

备注

外接程序模型不使用应用于外接程序的宿主视图的限定数据。The add-in model does not use qualification data that is applied to the host view of the add-in. 因此, 枚举限定数据时, 将找不到任何Segment属性为AddInSegmentType.HostViewOfAddIn的项。As a result, when you enumerate qualification data you will not find any items whose Segment property is AddInSegmentType.HostViewOfAddIn.

或者, 可以使用QualificationData属性来获取嵌套的字典集, 其中包含管线段的限定数据。Alternatively, you can use the QualificationData property to get a nested set of dictionaries that contain the qualification data of the pipeline segments.

适用于