Partilhar via


XStreamingElement.Name Propriedade

Definição

Obtém ou define o nome deste elemento de streaming.

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

Valor da propriedade

XName

Um XName que contém o nome desse elemento de streaming.

Exemplos

Este exemplo cria um novo elemento de streaming e, em seguida, imprime o nome do elemento.

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)  

Esse exemplo gera a saída a seguir:

NewRoot  

Aplica-se a

Confira também