XmlArrayItemAttribute.ElementName プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > XmlArrayItemAttribute.ElementName プロパティの意味・解説 

XmlArrayItemAttribute.ElementName プロパティ

生成されXML 要素の名前を取得または設定します

名前空間: System.Xml.Serialization
アセンブリ: System.Xml (system.xml.dll 内)
構文構文

Dim instance As XmlArrayItemAttribute
Dim value As String

value = instance.ElementName

instance.ElementName = value
public string ElementName { get;
 set; }
/** @property */
public String get_ElementName ()

/** @property */
public void set_ElementName (String value)
public function get ElementName
 () : String

public function set ElementName
 (value : String)

プロパティ
生成されXML 要素の名前。既定値は、メンバ識別子です。

解説解説
使用例使用例

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
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
XmlArrayItemAttribute クラス
XmlArrayItemAttribute メンバ
System.Xml.Serialization 名前空間


このページでは「.NET Framework クラス ライブラリ リファレンス」からXmlArrayItemAttribute.ElementName プロパティを検索した結果を表示しています。
Weblioに収録されているすべての辞書からXmlArrayItemAttribute.ElementName プロパティを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からXmlArrayItemAttribute.ElementName プロパティ を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「XmlArrayItemAttribute.ElementName プロパティ」の関連用語

XmlArrayItemAttribute.ElementName プロパティのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



XmlArrayItemAttribute.ElementName プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS