Evidence.GetEnumerator 方法

定义

警告

此 API 现已过时。

枚举集合中的所有证据,包括由主机提供的证据和由程序集提供的证据。Enumerates all evidence in the set, both that provided by the host and that provided by the assembly.

public:
 virtual System::Collections::IEnumerator ^ GetEnumerator();
[System.Obsolete]
[System.Obsolete("GetEnumerator is obsolete. Please use GetAssemblyEnumerator and GetHostEnumerator instead.")]
public System.Collections.IEnumerator GetEnumerator ();
abstract member GetEnumerator : unit -> System.Collections.IEnumerator
override this.GetEnumerator : unit -> System.Collections.IEnumerator
Public Function GetEnumerator () As IEnumerator

返回

AddHost(Object) 方法和 AddAssembly(Object) 方法添加的证据的枚举数。An enumerator for evidence added by both the AddHost(Object) method and the AddAssembly(Object) method.

实现

属性

示例

下面的代码示例演示如何使用 GetEnumerator 方法。The following code example shows the use of the GetEnumerator method. 此示例是为 Evidence 类提供的更大示例的一部分。This example is part of a larger example provided for the Evidence class.

int p = 0;
Console::WriteLine( "\nCurrent evidence = " );
if ( nullptr == myEvidence )
      return 0;

IEnumerator^ list = myEvidence->GetEnumerator();
IEnumerator^ myEnum1 = list;
while ( myEnum1->MoveNext() )
{
   Object^ obj = safe_cast<Object^>(myEnum1->Current);
   Console::WriteLine( obj );
   p++;
}
int p = 0;
Console.WriteLine("\nCurrent evidence = ");
if (null == myEvidence) return 0;
IEnumerator list = myEvidence.GetEnumerator();
while (list.MoveNext())
{
    Console.WriteLine(list.Current.ToString());
}
Dim p As Integer = 0
Console.WriteLine(ControlChars.Lf & "Current evidence = ")
If myEvidence Is Nothing Then
    Return 0
End If
Dim list As IEnumerator = myEvidence.GetEnumerator()
Dim obj As Object
While list.MoveNext()
    Console.WriteLine(list.Current.ToString())
    p = p + 1
End While

适用于