Szerkesztés

Megosztás a következőn keresztül:


XStreamingElement.Name Property

Definition

Gets or sets the name of this streaming element.

public:
 property System::Xml::Linq::XName ^ Name { System::Xml::Linq::XName ^ get(); void set(System::Xml::Linq::XName ^ value); };
public System.Xml.Linq.XName Name { get; set; }
member this.Name : System.Xml.Linq.XName with get, set
Public Property Name As XName

Property Value

An XName that contains the name of this streaming element.

Examples

This example creates a new streaming element, and then prints the name of the element.

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.Name);
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.Name)

This example produces the following output:

NewRoot

Applies to

See also