XStreamingElement コンストラクター

定義

XStreamingElement クラスの新しいインスタンスを初期化します。

オーバーロード

名前 説明
XStreamingElement(XName)

指定したXElementからXName クラスの新しいインスタンスを初期化します。

XStreamingElement(XName, Object)

指定した名前とコンテンツを使用して、 XStreamingElement クラスの新しいインスタンスを初期化します。

XStreamingElement(XName, Object[])

指定した名前とコンテンツを使用して、 XStreamingElement クラスの新しいインスタンスを初期化します。

注釈

クエリは、 XStreamingElement がシリアル化されるまで反復処理されません。 これは、新しいXElementの作成時にクエリが反復処理されるXElementのコンテンツに対してクエリを使用するのとは対照的です。

このコンストラクターに渡すことができる有効なコンテンツの詳細については、「 XElement オブジェクトと XDocument オブジェクトの有効なコンテンツ」を参照してください。

XStreamingElement(XName)

ソース:
XStreamingElement.cs
ソース:
XStreamingElement.cs
ソース:
XStreamingElement.cs
ソース:
XStreamingElement.cs
ソース:
XStreamingElement.cs

指定したXElementからXName クラスの新しいインスタンスを初期化します。

public:
 XStreamingElement(System::Xml::Linq::XName ^ name);
public XStreamingElement(System.Xml.Linq.XName name);
new System.Xml.Linq.XStreamingElement : System.Xml.Linq.XName -> System.Xml.Linq.XStreamingElement
Public Sub New (name As XName)

パラメーター

name
XName

要素の名前を含む XName

XElement srcTree = new XElement("Root",
                       new XElement("Child", 1),
                       new XElement("Child", 2),
                       new XElement("Child", 3),
                       new XElement("Child", 4),
                       new XElement("Child", 5)
                   );

XStreamingElement dstTree = new XStreamingElement("NewRoot",
                        from el in srcTree.Elements()
                        where (int)el >= 3
                        select new XElement("DifferentChild", (int)el)
                    );

Console.WriteLine(dstTree);
Dim srcTree As XElement = _
        <Root>
            <Child>1</Child>
            <Child>2</Child>
            <Child>3</Child>
            <Child>4</Child>
            <Child>5</Child>
        </Root>

Dim dstTree As XStreamingElement = New XStreamingElement("NewRoot", _
                From el In srcTree.Elements _
                Where el.Value >= 3 _
                Select <DifferentChild><%= el.Value %></DifferentChild> _
            )

Console.WriteLine(dstTree)

この例を実行すると、次の出力が生成されます。

<NewRoot>
  <DifferentChild>3</DifferentChild>
  <DifferentChild>4</DifferentChild>
  <DifferentChild>5</DifferentChild>
</NewRoot>

注釈

このコンストラクターは、コンテンツと属性を持たないストリーミング要素を作成します。

文字列から XNameへの暗黙的な変換があります。 このコンストラクターの一般的な用途は、新しい XNameを作成するのではなく、パラメーターとして文字列を指定することです。

こちらもご覧ください

適用対象

XStreamingElement(XName, Object)

ソース:
XStreamingElement.cs
ソース:
XStreamingElement.cs
ソース:
XStreamingElement.cs
ソース:
XStreamingElement.cs
ソース:
XStreamingElement.cs

指定した名前とコンテンツを使用して、 XStreamingElement クラスの新しいインスタンスを初期化します。

public:
 XStreamingElement(System::Xml::Linq::XName ^ name, System::Object ^ content);
public XStreamingElement(System.Xml.Linq.XName name, object content);
public XStreamingElement(System.Xml.Linq.XName name, object? content);
new System.Xml.Linq.XStreamingElement : System.Xml.Linq.XName * obj -> System.Xml.Linq.XStreamingElement
Public Sub New (name As XName, content As Object)

パラメーター

name
XName

要素名を含む XName

content
Object

要素の内容。

この例では、Source.xmlという名前の次の XML ファイルを使用します。

<?xml version="1.0" encoding="utf-8" ?>
<Root>
  <Child Key="01">
    <GrandChild>aaa</GrandChild>
  </Child>
  <Child Key="02">
    <GrandChild>bbb</GrandChild>
  </Child>
  <Child Key="03">
    <GrandChild>ccc</GrandChild>
  </Child>
</Root>

注釈

このコンストラクターは、指定されたコンテンツと属性を持つストリーミング要素を作成します。

文字列から XNameへの暗黙的な変換があります。 このコンストラクターの一般的な用途は、新しい XNameを作成するのではなく、パラメーターとして文字列を指定することです。

クエリは、 XStreamingElement がシリアル化されるまで反復処理されません。 これは、新しいXElementの作成時にクエリが反復処理されるXElementのコンテンツに対してクエリを使用するのとは対照的です。

このコンストラクターに渡すことができる有効なコンテンツの詳細については、「 XElement オブジェクトと XDocument オブジェクトの有効なコンテンツ」を参照してください。

こちらもご覧ください

適用対象

XStreamingElement(XName, Object[])

ソース:
XStreamingElement.cs
ソース:
XStreamingElement.cs
ソース:
XStreamingElement.cs
ソース:
XStreamingElement.cs
ソース:
XStreamingElement.cs

指定した名前とコンテンツを使用して、 XStreamingElement クラスの新しいインスタンスを初期化します。

public:
 XStreamingElement(System::Xml::Linq::XName ^ name, ... cli::array <System::Object ^> ^ content);
public XStreamingElement(System.Xml.Linq.XName name, params object[] content);
public XStreamingElement(System.Xml.Linq.XName name, params object?[] content);
new System.Xml.Linq.XStreamingElement : System.Xml.Linq.XName * obj[] -> System.Xml.Linq.XStreamingElement
Public Sub New (name As XName, ParamArray content As Object())

パラメーター

name
XName

要素名を含む XName

content
Object[]

要素の内容。

この例では、Source.xmlという名前の次の XML ファイルを使用します。

<?xml version="1.0" encoding="utf-8" ?>
<Root>
  <Child Key="01">
    <GrandChild>aaa</GrandChild>
  </Child>
  <Child Key="02">
    <GrandChild>bbb</GrandChild>
  </Child>
  <Child Key="03">
    <GrandChild>ccc</GrandChild>
  </Child>
</Root>

注釈

このコンストラクターは、指定されたコンテンツと属性を持つストリーミング要素を作成します。

文字列から XNameへの暗黙的な変換があります。 このコンストラクターの一般的な用途は、新しい XNameを作成するのではなく、パラメーターとして文字列を指定することです。

クエリは、 XStreamingElement がシリアル化されるまで反復処理されません。 これは、新しいXElementの作成時にクエリが反復処理されるXElementのコンテンツに対してクエリを使用するのとは対照的です。

この関数に渡すことができる有効なコンテンツの詳細については、「 XElement オブジェクトと XDocument オブジェクトの有効なコンテンツ」を参照してください。

こちらもご覧ください

適用対象