SerializationInfoEnumerator.MoveNext 方法

定義

更新列舉值至下一個項目。Updates the enumerator to the next item.

public:
 virtual bool MoveNext();
public bool MoveNext ();
abstract member MoveNext : unit -> bool
override this.MoveNext : unit -> bool
Public Function MoveNext () As Boolean

傳回

如果已找到新的項目,則為 true,否則為 falsetrue if a new element is found; otherwise, false.

實作

範例

下列程式碼範例將示範如何MoveNext呼叫方法。The following code example demonstrates calling the MoveNext method. 這個程式碼範例是針對SerializationInfo類別提供之較大範例的一部分。This code example is part of a larger example provided for the SerializationInfo class.

private:
    static void DisplaySerializationInfo(SerializationInfo^ info)
    {
        Console::WriteLine("Values in the SerializationInfo:");
        for each (SerializationEntry^ infoEntry in info)
        {
            Console::WriteLine("Name={0}, ObjectType={1}, Value={2}",
                infoEntry->Name, infoEntry->ObjectType, infoEntry->Value);
        }
    }
private void DisplaySerializationInfo(SerializationInfo info)
{
    SerializationInfoEnumerator e = info.GetEnumerator();
    Console.WriteLine("Values in the SerializationInfo:");
    while (e.MoveNext())
    {
        Console.WriteLine("Name={0}, ObjectType={1}, Value={2}", e.Name, e.ObjectType, e.Value);
    }
}

備註

若要初始化枚舉器, MoveNext請呼叫並流覽每個專案, 直到到達最後一個元素為止。To initialize the enumerator, call MoveNext and go through each item until you reach the last element.

適用於