SerializationInfoEnumerator.Name 屬性

定義

取得目前正在檢查的項目名稱。Gets the name for the item currently being examined.

public:
 property System::String ^ Name { System::String ^ get(); };
public string Name { get; }
member this.Name : string
Public ReadOnly Property Name As String

屬性值

項目名稱。The item name.

例外狀況

列舉值已經開始列舉項目,或已經達到列舉型別的結尾。The enumerator has not started enumerating items or has reached the end of the enumeration.

範例

下列程式碼範例會示範Name屬性。The following code example demonstrates the Name property. 這個程式碼範例是針對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);
    }
}

適用於