DISABILITARE ADBLOCK

ADBlock sta bloccando alcuni contenuti del sito

ADBlock errore
5 Characters minimum

Hi there.

I had a XML file like this :

<Root>    <br />    <Child1>1</Child1>    <br />    <Child2>2</Child2>    <br />    <Child3>3</Child3>  <br /></Root>


I want to insert a child node between Child1 and child2 by LINQ.
I want to create something like this
<Root>    <br />    <Child1>1</Chil1d>    <br />    <ChildNew>New</ChildNew> <br />    <Child2>2</Child2>    <br />    <Child3>3</Child3>  <br /></Root>


How can I do it?
Thanks in advance.

Leggi tutto

Solution

VB

<br />       Dim firstElement = xmldoc.Descendants("Child1").First<br />        firstElement.AddAfterSelf(New XElement("ChildNew") With {.Value = "New"})<br />


Or C#
<br />       var firstElement = xmldoc.Descendants("Child1").First();<br />       firstElement.AddAfterSelf(new XElement("ChildNew") with {.Value = "New"});<br />


USEFUL SOURCES

CodeProject
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow