XmlArrayItemAttribute.ElementName プロパティ
アセンブリ: System.Xml (system.xml.dll 内)

Dim instance As XmlArrayItemAttribute Dim value As String value = instance.ElementName instance.ElementName = value
/** @property */ public String get_ElementName () /** @property */ public void set_ElementName (String value)
生成された XML 要素の名前。既定値は、メンバ識別子です。

生成された XML 要素の名前をメンバの識別子と異なる名前にする場合は、ElementName を指定します。
生成された XML ドキュメントが同一名のメンバを区別するために XML 名前空間を使用している場合は、同じ ElementName 値を複数のクラス メンバに設定できます。XML ドキュメントでの名前空間やプレフィックス付き名の使用方法については、XmlSerializerNamespaces クラスのトピックを参照してください。

Vehicle クラスおよび Car クラスの ElementName プロパティを設定することにより、XmlSerializer がこれらのクラスに対して生成する XML 要素の名前を変更する例を次に示します。
Public Class Transportation ' Specifies acceptable types and the ElementName generated ' for each object type. <XmlArray("Vehicles"), _ XmlArrayItem(GetType(Vehicle), ElementName := "Transport"), _ XmlArrayItem(GetType(Car), ElementName := "Automobile")> _ Public MyVehicles() As Vehicle End Class ' By default, this class results in XML elements named "Vehicle". Public Class Vehicle Public id As String End Class ' By default, this class results in XMl elements named "Car". Public Class Car Inherits Vehicle Public Maker As String End Class
public class Transportation { [XmlArray("Vehicles")] /* Specifies acceptable types and the ElementName generated for each object type. */ [XmlArrayItem(typeof(Vehicle), ElementName = "Transport"), XmlArrayItem(typeof(Car), ElementName = "Automobile")] public Vehicle[] MyVehicles; } // By default, this class results in XML elements named "Vehicle". public class Vehicle { public string id; } // By default, this class results in XML elements named "Car". public class Car:Vehicle { public string Maker; }
// By default, this class results in XML elements named "Vehicle". public ref class Vehicle { public: String^ id; }; // By default, this class results in XML elements named "Car". public ref class Car: public Vehicle { public: String^ Maker; }; public ref class Transportation { public: /* Specifies acceptable types and the ElementName generated for each object type. */ [XmlArray("Vehicles")] [XmlArrayItem(Vehicle::typeid,ElementName="Transport"), XmlArrayItem(Car::typeid,ElementName="Automobile")] array<Vehicle^>^MyVehicles; };
public class Transportation { /** @attribute XmlArray("Vehicles") */ /* Specifies acceptable types and the ElementName generated for each object type. */ /** @attribute XmlArrayItem(Vehicle.class, ElementName = "Transport") @attribute XmlArrayItem(Car.class, ElementName = "Automobile") */ public Vehicle myVehicles[]; } //Transportation // By default, this class results in XML elements named "Vehicle". public class Vehicle { public String id; } //Vehicle // By default, this class results in XML elements named "Car". public class Car extends Vehicle { public String maker; } //Car

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からXmlArrayItemAttribute.ElementName プロパティを検索する場合は、下記のリンクをクリックしてください。

- XmlArrayItemAttribute.ElementName プロパティのページへのリンク