XmlRootAttributeとは? わかりやすく解説

XmlRootAttribute クラス

属性ターゲットXML ルート要素として XML シリアル化する方法制御します

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

<AttributeUsageAttribute(AttributeTargets.Class Or AttributeTargets.Struct
 Or AttributeTargets.Enum Or AttributeTargets.Interface
 Or AttributeTargets.ReturnValue)> _
Public Class XmlRootAttribute
    Inherits Attribute
Dim instance As XmlRootAttribute
[AttributeUsageAttribute(AttributeTargets.Class|AttributeTargets.Struct|AttributeTargets.Enum|AttributeTargets.Interface|AttributeTargets.ReturnValue)]
 
public class XmlRootAttribute : Attribute
[AttributeUsageAttribute(AttributeTargets::Class|AttributeTargets::Struct|AttributeTargets::Enum|AttributeTargets::Interface|AttributeTargets::ReturnValue)]
 
public ref class XmlRootAttribute : public
 Attribute
/** @attribute AttributeUsageAttribute(AttributeTargets.Class|AttributeTargets.Struct|AttributeTargets.Enum|AttributeTargets.Interface|AttributeTargets.ReturnValue)
 */ 
public class XmlRootAttribute extends Attribute
AttributeUsageAttribute(AttributeTargets.Class|AttributeTargets.Struct|AttributeTargets.Enum|AttributeTargets.Interface|AttributeTargets.ReturnValue)
 
public class XmlRootAttribute extends
 Attribute
解説解説

XmlRootAttribute は、XmlSerializer がオブジェクトシリアル化または逆シリアル化する方法制御する一連の属性1 つです。類似する属性の完全な一覧については、「XML シリアル化制御する属性」を参照してください

XmlRootAttribute は、クラス構造体列挙体、またはインターフェイス適用できますまた、この属性は、XML Web サービス メソッド戻り値にも適用できます

すべての XML ドキュメントには、他のすべての要素を含むルート要素1 つ必要です。XmlRootAttribute使用すると、XmlSerializerルート要素生成する方法を、特定のプロパティ設定することによって制御できます。たとえば、ElementName プロパティ設定することにより、生成される XML 要素の名前を指定します

属性使用方法については、「属性使用したメタデータ拡張」を参照してください

メモメモ

コードでは、XmlRootAttribute代わりに XmlRoot という短い語を使用できます

使用例使用例

XmlRootAttributeクラス適用する例を次に示します。この属性は、要素名と名前空間指定し要素修飾するかどうか、およびクラスnull 参照 (Visual Basic では Nothing) に設定されている場合xsi:nil 属性生成するかどうか指定します

Imports System
Imports System.IO
Imports System.Xml
Imports System.Xml.Schema
Imports System.Xml.Serialization

<XmlRoot(Namespace:="www.contoso.com",
 _
    ElementName:="MyGroupName", _
    DataType:="string", _
    IsNullable:=True)> _
Public Class Group

    Private groupNameValue As String
    ' Insert code for the Group class.
    Public Sub New()

    End Sub

    Public Sub New(ByVal
 groupNameVal As String)

        groupNameValue = groupNameVal
    End Sub

    Property GroupName() As String
        Get
            Return groupNameValue
        End Get

        Set(ByVal Value As
 String)
            groupNameValue = Value
        End Set
    End Property
End Class

Public Class Test

    Shared Sub Main()

        Dim t As Test = New
 Test()
        t.SerializeGroup()
    End Sub

    Private Sub SerializeGroup()

        ' Create an instance of the Group class, and an
        ' instance of the XmlSerializer to serialize it.
        Dim myGroup As Group = New
 Group("Redmond")
        Dim ser As XmlSerializer = New
 XmlSerializer(GetType(Group))

        ' A FileStream is used to write the file.
        Dim fs As FileStream = New
 FileStream("group.xml", FileMode.Create)
        ser.Serialize(fs, myGroup)
        fs.Close()
        Console.WriteLine(myGroup.GroupName)
        Console.WriteLine("Done... Press any key to exit.")
        Console.ReadLine()
    End Sub

End Class
using System;
using System.IO;
using System.Xml;
using System.Xml.Schema;
using System.Xml.Serialization;

[XmlRoot(Namespace = "www.contoso.com", 
     ElementName = "MyGroupName", 
     DataType = "string", 
     IsNullable=true)]
public class Group
{
    private string groupNameValue;
    // Insert code for the Group class.
    public Group()
    {
    }
 
    public Group(string groupNameVal)
    {
        groupNameValue = groupNameVal;
    }
 
    public string GroupName
    {
        get{return groupNameValue;}
        set{groupNameValue = value;}
    }
}
public class Test
{
    static void Main()
    {
        Test t = new Test();
        t.SerializeGroup();
    }
 
    private void SerializeGroup()
    {
        // Create an instance of the Group class, and an
        // instance of the XmlSerializer to serialize it.
        Group myGroup = new Group("Redmond");
        XmlSerializer ser = new XmlSerializer(typeof(Group));
        // A FileStream is used to write the file.
        FileStream fs = new FileStream("group.xml",FileMode.Create);
        ser.Serialize(fs,myGroup);
        fs.Close();
        Console.WriteLine(myGroup.GroupName);
        Console.WriteLine("Done");
        Console.ReadLine();
    }
}
#using <System.Xml.dll>
#using <System.dll>

using namespace System;
using namespace System::IO;
using namespace System::Xml;
using namespace System::Xml::Schema;
using namespace System::Xml::Serialization;

[XmlRoot(Namespace="www.contoso.com",
ElementName="MyGroupName",
DataType="string",
IsNullable=true)]
public ref class Group
{
private:
   String^ groupNameValue;

public:

   // Insert code for the Group class.
   Group(){}

   Group( String^ groupNameVal )
   {
      groupNameValue = groupNameVal;
   }

   property String^ GroupName 
   {
      String^ get()
      {
         return groupNameValue;
      }
      void set( String^ value )
      {
         groupNameValue = value;
      }

   }

};

void SerializeGroup()
{
   // Create an instance of the Group class, and an
   // instance of the XmlSerializer to serialize it.
   Group^ myGroup = gcnew Group( "Redmond" );
   XmlSerializer^ ser = gcnew XmlSerializer( Group::typeid );

   // A FileStream is used to write the file.
   FileStream^ fs = gcnew FileStream( "group.xml",FileMode::Create );
   ser->Serialize( fs, myGroup );
   fs->Close();
   Console::WriteLine( myGroup->GroupName );
   Console::WriteLine( "Done" );
   Console::ReadLine();
}

int main()
{
   SerializeGroup();
}
import System.*;
import System.IO.*;
import System.Xml.*;
import System.Xml.Schema.*;
import System.Xml.Serialization.*;

/** @attribute XmlRoot(Namespace = "www.contoso.com", ElementName = "MyGroupName"
,
    DataType = "string", IsNullable = true)
 */
public class Group
{
    private String groupNameValue;
    // Insert code for the Group class.
    public Group()
    {
    } //Group
    
    public Group(String groupNameVal)
    {
        groupNameValue = groupNameVal;
    } //Group

    /** @property
     */
    public String get_GroupName()
    {
        return groupNameValue;
    } //get_GroupName

    /** @property 
     */
    public void set_GroupName(String value)
    {
        groupNameValue = value;
    } //set_GroupName
} //Group

public class Test
{
    public static void main(String[]
 args)
    {
        Test t = new Test();
        t.SerializeGroup();
    } //main

    private void SerializeGroup()
    {
        // Create an instance of the Group class, and an
        // instance of the XmlSerializer to serialize it.
        Group myGroup = new Group("Redmond");
        XmlSerializer ser = new XmlSerializer(Group.class.ToType());

        // A FileStream is used to write the file.
        FileStream fs = new FileStream("group.xml",
 FileMode.Create);

        ser.Serialize(fs, myGroup);
        fs.Close();
        Console.WriteLine(myGroup.get_GroupName());
        Console.WriteLine("Done");
        Console.ReadLine();
    } //SerializeGroup
} //Test
継承階層継承階層
System.Object
   System.Attribute
    System.Xml.Serialization.XmlRootAttribute
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

XmlRootAttribute コンストラクタ ()

XmlRootAttribute クラス新しインスタンス初期化します。

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

Dim instance As New XmlRootAttribute
public XmlRootAttribute ()
public:
XmlRootAttribute ()
public XmlRootAttribute ()
public function XmlRootAttribute ()
使用例使用例

この例では、XmlRootAttributeインスタンス作成し、そのインスタンスを XmlAttributes オブジェクトの XmlRoot プロパティ割り当ててます。XmlSerializer は、MyClass オブジェクトシリアル化するときに、XmlRootAttribute オブジェクト使用して既定ルート要素オーバーライドます。

Imports System
Imports System.IO
Imports System.Xml.Serialization


' This is the class that is the default root element.
Public Class MyClass1
    Public Name As String
End Class

Public Class Run
    
    Public Shared Sub Main()
        Dim test As New
 Run()
        test.SerializeOrder("OverrideAttribute.xml")
    End Sub
        
    Public Sub SerializeOrder(ByVal
 filename As String)
        ' Create an XmlSerializer instance using the method below.
        Dim xSer As XmlSerializer = CreateOverrider()
        
        ' Create the object, and set its Name property.
        Dim class1 As New
 MyClass1()
        class1.Name = "New Class Name"
        
        ' Serialize the class, and close the TextWriter.
        Dim writer As New
 StreamWriter(filename)
        xSer.Serialize(writer, class1)
        writer.Close()
    End Sub 'SerializeOrder
    
    
    ' Return an XmlSerializer to override the root serialization.
    Public Function CreateOverrider() As
 XmlSerializer
        ' Create an XmlAttributes to override the default root element.
        Dim attrs As New
 XmlAttributes()
        
        ' Create an XmlRootAttribute and set its element name and namespace.
        Dim xRoot As New
 XmlRootAttribute()
        xRoot.ElementName = "OverriddenRootElementName"
        xRoot.Namespace = "http://www.microsoft.com"
        
        ' Set the XmlRoot property to the XmlRoot object.
        attrs.XmlRoot = xRoot
        Dim xOver As New
 XmlAttributeOverrides()
        
        ' Add the XmlAttributes object to the
        ' XmlAttributeOverrides object. 
        xOver.Add(GetType(MyClass1), attrs)
        
        ' Create the Serializer, and return it.
        Dim xSer As New
 XmlSerializer(GetType(MyClass1), xOver)
        Return xSer
    End Function
End Class

using System;
using System.IO;
using System.Xml.Serialization;

// This is the class that is the default root element.
public class MyClass
{
   public string Name;
}

public class Run 
{
   public static void Main()
   {
      Run test = new Run();
      test.SerializeOrder("OverrideAttribute.xml");
   }

   public void SerializeOrder(string
 filename)
   {
      // Create an XmlSerializer instance using the method below.
      XmlSerializer xSer = CreateOverrider();

      // Create the object, and set its Name property.
      MyClass myClass = new MyClass();
      myClass.Name = "New Class Name";

      // Serialize the class, and close the TextWriter.
      TextWriter writer = new StreamWriter(filename);
      xSer.Serialize(writer, myClass);
      writer.Close();
   }

   // Return an XmlSerializer to override the root serialization.
   public XmlSerializer CreateOverrider()
   {
      // Create an XmlAttributes to override the default root element.
      XmlAttributes attrs = new XmlAttributes();

      // Create an XmlRootAttribute and set its element name and namespace.
      XmlRootAttribute xRoot = new XmlRootAttribute();
      xRoot.ElementName = "OverriddenRootElementName";
      xRoot.Namespace = "http://www.microsoft.com";

      // Set the XmlRoot property to the XmlRoot object.
      attrs.XmlRoot = xRoot;
      XmlAttributeOverrides xOver = new XmlAttributeOverrides();
      
      /* Add the XmlAttributes object to the 
      XmlAttributeOverrides object. */
      xOver.Add(typeof(MyClass), attrs);

      // Create the Serializer, and return it.
      XmlSerializer xSer = new XmlSerializer
      (typeof(MyClass), xOver);
      return xSer;
   }
}

#using <System.Xml.dll>
#using <System.dll>

using namespace System;
using namespace System::IO;
using namespace System::Xml::Serialization;

// This is the class that is the default root element.
public ref class MyClass
{
public:
   String^ Name;
};

XmlSerializer^ CreateOverrider();
void SerializeOrder( String^ filename )
{
   // Create an XmlSerializer instance using the method below.
   XmlSerializer^ xSer = CreateOverrider();

   // Create the object, and set its Name property.
   MyClass^ myClass = gcnew MyClass;
   myClass->Name = "New Class Name";

   // Serialize the class, and close the TextWriter.
   TextWriter^ writer = gcnew StreamWriter( filename );
   xSer->Serialize( writer, myClass );
   writer->Close();
}

// Return an XmlSerializer to override the root serialization.
XmlSerializer^ CreateOverrider()
{
   // Create an XmlAttributes to override the default root element.
   XmlAttributes^ attrs = gcnew XmlAttributes;

   // Create an XmlRootAttribute and set its element name and namespace.
   XmlRootAttribute^ xRoot = gcnew XmlRootAttribute;
   xRoot->ElementName = "OverriddenRootElementName";
   xRoot->Namespace = "http://www.microsoft.com";

   // Set the XmlRoot property to the XmlRoot object.
   attrs->XmlRoot = xRoot;
   XmlAttributeOverrides^ xOver = gcnew XmlAttributeOverrides;

   /* Add the XmlAttributes object to the 
      XmlAttributeOverrides object. */
   xOver->Add( MyClass::typeid, attrs );

   // Create the Serializer, and return it.
   XmlSerializer^ xSer = gcnew XmlSerializer( MyClass::typeid,xOver );
   return xSer;
}

int main()
{
   SerializeOrder( "OverrideAttribute.xml" );
}
import System.*;
import System.IO.*;
import System.Xml.Serialization.*;

// This is the class that is the default root element.
public class MyClass
{
    public String name;
} //MyClass

public class Run
{
    public static void main(String[]
 args)
    {
        Run test = new Run();
        test.SerializeOrder("OverrideAttribute.xml");
    } //main

    public void SerializeOrder(String fileName)
    {
        // Create an XmlSerializer instance using the method below.
        XmlSerializer xSer = CreateOverrider();

        // Create the object, and set its Name property.
        MyClass myClass = new MyClass();
        myClass.name = "New Class Name";

        // Serialize the class, and close the TextWriter.
        TextWriter writer = new StreamWriter(fileName);
        xSer.Serialize(writer, myClass);
        writer.Close();
    } //SerializeOrder

    // Return an XmlSerializer to override the root serialization.
    public XmlSerializer CreateOverrider()
    {
        // Create an XmlAttributes to override the default root element.
        XmlAttributes attrs = new XmlAttributes();

        // Create an XmlRootAttribute and set its element name and namespace.
        XmlRootAttribute xRoot = new XmlRootAttribute();
        xRoot.set_ElementName("OverriddenRootElementName");
        xRoot.set_Namespace("http://www.microsoft.com");

        // Set the XmlRoot property to the XmlRoot object.
        attrs.set_XmlRoot(xRoot);
        XmlAttributeOverrides xOver = new XmlAttributeOverrides();

        /* Add the XmlAttributes object to the 
           XmlAttributeOverrides object. */
        xOver.Add(MyClass.class.ToType(), attrs);

        // Create the Serializer, and return it.
        XmlSerializer xSer = new XmlSerializer(MyClass.class.ToType(),
 xOver);
        return xSer;
    } //CreateOverrider
} //Run
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
XmlRootAttribute クラス
XmlRootAttribute メンバ
System.Xml.Serialization 名前空間
XmlAttributes.XmlRoot プロパティ
XmlAttributeOverrides クラス

XmlRootAttribute コンストラクタ (String)

XmlRootAttribute クラス新しインスタンス初期化しXML ルート要素の名前を指定します

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

Public Sub New ( _
    elementName As String _
)
Dim elementName As String

Dim instance As New XmlRootAttribute(elementName)
public XmlRootAttribute (
    string elementName
)
public:
XmlRootAttribute (
    String^ elementName
)
public XmlRootAttribute (
    String elementName
)
public function XmlRootAttribute (
    elementName : String
)

パラメータ

elementName

XML ルート要素の名前。

使用例使用例

次の例では、XmlRootAttribute のインスタンス作成し、そのインスタンス使用して、"Student" というクラスインスタンスシリアル化オーバーライドます。

Public Sub SerializeOrder(filename As
 String)
   ' Create an XmlSerializer instance using the method below.
   Dim myXmlSerializer As XmlSerializer = CreateOverrider()

   ' Create the object, and set its Name property.
   Dim myStudent As New
 Student()
   myStudent.Name = "Student class1"

   ' Serialize the class, and close the TextWriter.
   Dim writer = New StreamWriter(filename)
   myXmlSerializer.Serialize(writer, myStudent)
   writer.Close()
End Sub

' Return an XmlSerializer to override the root serialization.
Public Function CreateOverrider() As
 XmlSerializer
   ' Create an XmlAttributes to override the default root element.
   Dim myXmlAttributes As New
 XmlAttributes()

   ' Create an XmlRootAttribute overloaded constructer and set its namespace.
   Dim myXmlRootAttribute As New
 XmlRootAttribute("OverriddenRootElementName")
   myXmlRootAttribute.Namespace = "http://www.microsoft.com"

   ' Set the XmlRoot property to the XmlRoot object.
   myXmlAttributes.XmlRoot = myXmlRootAttribute
   Dim myXmlAttributeOverrides As New
 XmlAttributeOverrides()

   ' Add the XmlAttributes object to the XmlAttributeOverrides object.
   myXmlAttributeOverrides.Add(GetType(Student), myXmlAttributes)

   ' Create the Serializer, and return it.
   Dim myXmlSerializer As New
 XmlSerializer(GetType(Student), myXmlAttributeOverrides)
   Return myXmlSerializer
End Function
public void SerializeOrder(string
 filename)
{
   // Create an XmlSerializer instance using the method below.
   XmlSerializer myXmlSerializer = CreateOverrider();

   // Create the object, and set its Name property.
   Student myStudent = new Student();
   myStudent.Name = "Student class1";

   // Serialize the class, and close the TextWriter.
   TextWriter writer = new StreamWriter(filename);
   myXmlSerializer.Serialize(writer, myStudent);
   writer.Close();
}

// Return an XmlSerializer to override the root serialization.
public XmlSerializer CreateOverrider()
{
   // Create an XmlAttributes to override the default root element.
   XmlAttributes myXmlAttributes = new XmlAttributes();

   // Create an XmlRootAttribute overloaded constructer 
   //and set its namespace.
   XmlRootAttribute myXmlRootAttribute = 
                  new XmlRootAttribute("OverriddenRootElementName");
   myXmlRootAttribute.Namespace = "http://www.microsoft.com";

   // Set the XmlRoot property to the XmlRoot object.
   myXmlAttributes.XmlRoot = myXmlRootAttribute;
   XmlAttributeOverrides myXmlAttributeOverrides = 
                                       new XmlAttributeOverrides();
   
   /* Add the XmlAttributes object to the 
   XmlAttributeOverrides object. */
   myXmlAttributeOverrides.Add(typeof(Student), myXmlAttributes);

   // Create the Serializer, and return it.
   XmlSerializer myXmlSerializer = new XmlSerializer
      (typeof(Student), myXmlAttributeOverrides);
   return myXmlSerializer;
}
public:
   void SerializeOrder( String^ filename )
   {
      // Create an XmlSerializer instance using the method below.
      XmlSerializer^ myXmlSerializer = CreateOverrider();
      
      // Create the object, and set its Name property.
      Student^ myStudent = gcnew Student;
      myStudent->Name = "Student class1";
      
      // Serialize the class, and close the TextWriter.
      TextWriter^ writer = gcnew StreamWriter( filename );
      myXmlSerializer->Serialize( writer, myStudent );
      writer->Close();
   }

   // Return an XmlSerializer to  the root serialization.
   XmlSerializer^ CreateOverrider()
   {
      // Create an XmlAttributes to  the default root element.
      XmlAttributes^ myXmlAttributes = gcnew XmlAttributes;
      
      // Create an XmlRootAttribute overloaded constructer 
      // and set its namespace.
      XmlRootAttribute^ myXmlRootAttribute =
         gcnew XmlRootAttribute( "OverriddenRootElementName" );
      myXmlRootAttribute->Namespace = "http://www.microsoft.com";
      
      // Set the XmlRoot property to the XmlRoot object.
      myXmlAttributes->XmlRoot = myXmlRootAttribute;
      XmlAttributeOverrides^ myXmlAttributeOverrides =
         gcnew XmlAttributeOverrides;
      
      // Add the XmlAttributes object to the XmlAttributeOverrides object
      myXmlAttributeOverrides->Add( Student::typeid, myXmlAttributes );
      
      // Create the Serializer, and return it.
      XmlSerializer^ myXmlSerializer = gcnew XmlSerializer(
         Student::typeid, myXmlAttributeOverrides );
      return myXmlSerializer;
   }
public void SerializeOrder(String fileName)
{
    // Create an XmlSerializer instance using the method below.
    XmlSerializer myXmlSerializer = CreateOverrider();
    // Create the object, and set its name property.
    Student myStudent = new Student();
    myStudent.name = "Student class1";
    // Serialize the class, and close the TextWriter.
    TextWriter writer = new StreamWriter(fileName);
    myXmlSerializer.Serialize(writer, myStudent);
    writer.Close();
} //SerializeOrder

// Return an XmlSerializer to override the root serialization.
public XmlSerializer CreateOverrider()
{
    // Create an XmlAttributes to override the default root element.
    XmlAttributes myXmlAttributes = new XmlAttributes();
    // Create an XmlRootAttribute overloaded constructer 
    //and set its namespace.
    XmlRootAttribute myXmlRootAttribute = new XmlRootAttribute(
        "OverriddenRootElementName");
    myXmlRootAttribute.set_Namespace("http://www.microsoft.com");
    // Set the XmlRoot property to the XmlRoot object.
    myXmlAttributes.set_XmlRoot(myXmlRootAttribute);
    XmlAttributeOverrides myXmlAttributeOverrides =
        new XmlAttributeOverrides();

    /* Add the XmlAttributes object to the 
       XmlAttributeOverrides object.
     */
    myXmlAttributeOverrides.Add(Student.class.ToType(), myXmlAttributes);
    // Create the Serializer, and return it.
    XmlSerializer myXmlSerializer = new XmlSerializer(
        Student.class.ToType(), myXmlAttributeOverrides);
    return myXmlSerializer;
} //CreateOverrider
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
XmlRootAttribute クラス
XmlRootAttribute メンバ
System.Xml.Serialization 名前空間
ElementName

XmlRootAttribute コンストラクタ

XmlRootAttribute クラス新しインスタンス初期化し、そのクラス名XML ルート要素の名前として使用します
オーバーロードの一覧オーバーロードの一覧

参照参照

関連項目

XmlRootAttribute クラス
XmlRootAttribute メンバ
System.Xml.Serialization 名前空間
XmlAttributes.XmlRoot プロパティ
XmlAttributeOverrides クラス

XmlRootAttribute プロパティ


パブリック プロパティパブリック プロパティ

  名前 説明
パブリック プロパティ .NET Compact Framework によるサポート .NET Compact Framework によるサポート .NET Compact Framework によるサポート .NET Compact Framework によるサポート .NET Compact Framework によるサポート TypeId  派生クラス実装されている場合は、この Attribute一意識別子取得します。 ( Attribute から継承されます。)
参照参照

関連項目

XmlRootAttribute クラス
System.Xml.Serialization 名前空間
XmlArrayAttribute クラス
XmlElementAttribute クラス
XmlSerializer
XmlAttributes クラス

その他の技術情報

XML シリアル化概要
方法 : XML ストリーム代替要素名を指定する
属性使用した XML シリアル化制御
XML シリアル化の例
XML スキーマ定義ツール (Xsd.exe)

XmlRootAttribute メソッド


パブリック メソッドパブリック メソッド

( プロテクト メソッド参照)
  名前 説明
パブリック メソッド Equals  オーバーロードされます。 ( Attribute から継承されます。)
パブリック メソッド GetCustomAttribute  オーバーロードされますアセンブリモジュール、型のメンバ、またはメソッド パラメータ適用され指定した型のカスタム属性取得します。 ( Attribute から継承されます。)
パブリック メソッド GetCustomAttributes  オーバーロードされますアセンブリモジュール、型のメンバ、またはメソッド パラメータ適用されカスタム属性配列取得します。 ( Attribute から継承されます。)
パブリック メソッド GetHashCode  このインスタンスハッシュ コード返します。 ( Attribute から継承されます。)
パブリック メソッド GetType  現在のインスタンスType取得します。 ( Object から継承されます。)
パブリック メソッド IsDefaultAttribute  派生クラス内でオーバーライドされたときに、このインスタンスの値が派生クラス既定値かどうか示します。 ( Attribute から継承されます。)
パブリック メソッド IsDefined  オーバーロードされます指定した型のカスタム属性が、アセンブリモジュール、型のメンバ、またはメソッド パラメータ適用されているかどうか判断します。 ( Attribute から継承されます。)
パブリック メソッド Match  派生クラス内でオーバーライドされたときに、指定したオブジェクトとこのインスタンス等しかどうかを示す値を返します。 ( Attribute から継承されます。)
パブリック メソッド ReferenceEquals  指定した複数Object インスタンス同一かどうか判断します。 ( Object から継承されます。)
パブリック メソッド ToString  現在の Object を表す String返します。 ( Object から継承されます。)
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

XmlRootAttribute クラス
System.Xml.Serialization 名前空間
XmlArrayAttribute クラス
XmlElementAttribute クラス
XmlSerializer
XmlAttributes クラス

その他の技術情報

XML シリアル化概要
方法 : XML ストリーム代替要素名を指定する
属性使用した XML シリアル化制御
XML シリアル化の例
XML スキーマ定義ツール (Xsd.exe)

XmlRootAttribute メンバ

属性ターゲットXML ルート要素として XML シリアル化する方法制御します

XmlRootAttribute データ型公開されるメンバを以下の表に示します


パブリック コンストラクタパブリック コンストラクタ
  名前 説明
パブリック メソッド XmlRootAttribute オーバーロードされます。 XmlRootAttribute クラス新しインスタンス初期化し、そのクラス名XML ルート要素の名前として使用します
パブリック プロパティパブリック プロパティ
  名前 説明
パブリック プロパティ .NET Compact Framework によるサポート .NET Compact Framework によるサポート .NET Compact Framework によるサポート .NET Compact Framework によるサポート .NET Compact Framework によるサポート TypeId  派生クラス実装されている場合は、この Attribute一意識別子取得します。(Attribute から継承されます。)
パブリック メソッドパブリック メソッド
( プロテクト メソッド参照)
  名前 説明
パブリック メソッド Equals  オーバーロードされます。 ( Attribute から継承されます。)
パブリック メソッド GetCustomAttribute  オーバーロードされますアセンブリモジュール、型のメンバ、またはメソッド パラメータ適用され指定した型のカスタム属性取得します。 (Attribute から継承されます。)
パブリック メソッド GetCustomAttributes  オーバーロードされますアセンブリモジュール、型のメンバ、またはメソッド パラメータ適用されカスタム属性配列取得します。 (Attribute から継承されます。)
パブリック メソッド GetHashCode  このインスタンスハッシュ コード返します。 (Attribute から継承されます。)
パブリック メソッド GetType  現在のインスタンスType取得します。 (Object から継承されます。)
パブリック メソッド IsDefaultAttribute  派生クラス内でオーバーライドされたときに、このインスタンスの値が派生クラス既定値かどうか示します。 (Attribute から継承されます。)
パブリック メソッド IsDefined  オーバーロードされます指定した型のカスタム属性が、アセンブリモジュール、型のメンバ、またはメソッド パラメータ適用されているかどうか判断します。 (Attribute から継承されます。)
パブリック メソッド Match  派生クラス内でオーバーライドされたときに、指定したオブジェクトとこのインスタンス等しかどうかを示す値を返します。 (Attribute から継承されます。)
パブリック メソッド ReferenceEquals  指定した複数Object インスタンス同一かどうか判断します。 (Object から継承されます。)
パブリック メソッド ToString  現在の Object を表す String返します。 (Object から継承されます。)
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

XmlRootAttribute クラス
System.Xml.Serialization 名前空間
XmlArrayAttribute クラス
XmlElementAttribute クラス
XmlSerializer
XmlAttributes クラス

その他の技術情報

XML シリアル化概要
方法 : XML ストリーム代替要素名を指定する
属性使用した XML シリアル化制御
XML シリアル化の例
XML スキーマ定義ツール (Xsd.exe)



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

辞書ショートカット

すべての辞書の索引

「XmlRootAttribute」の関連用語

XmlRootAttributeのお隣キーワード
検索ランキング

   

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



XmlRootAttributeのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2025 GRAS Group, Inc.RSS