ref/value variable types in LINQ TO XML (VB)

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hello
have been using LINQ to XML for a couple of months and finding it really useful. However theres something which I havent fully understood and I hope someone can help me out.
If I do something like the code below:
<span style="font-size:x-small; color:#0000ff; font-family:Consolas <span style="font-size:x-small; color:#0000ff; font-family:Consolas <span style="font-size:x-small; color:#0000ff; font-family:Consolas Dim <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas xel
<span style="font-size:x-small; color:#0000ff; font-family:Consolas <span style="font-size:x-small; color:#0000ff; font-family:Consolas <span style="font-size:x-small; color:#0000ff; font-family:Consolas As<span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas
<span style="font-size:x-small; color:#2b91af; font-family:Consolas <span style="font-size:x-small; color:#2b91af; font-family:Consolas <span style="font-size:x-small; color:#2b91af; font-family:Consolas XElement
<span style="font-size:x-small; color:#2b91af; font-family:Consolas
<span style="font-size:x-small; color:#2b91af; font-family:Consolas
<span style="font-size:x-small; color:#2b91af; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas = (<span style="font-size:x-small; color:#0000ff; font-family:Consolas <span style="font-size:x-small; color:#0000ff; font-family:Consolas <span style="font-size:x-small; color:#0000ff; font-family:Consolas From<span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas x
<span style="font-size:x-small; color:#0000ff; font-family:Consolas <span style="font-size:x-small; color:#0000ff; font-family:Consolas <span style="font-size:x-small; color:#0000ff; font-family:Consolas In
<span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas XmlDoc<span style="font-size:x-small; color:#6464b9; font-family:Consolas <span style="font-size:x-small; color:#6464b9; font-family:Consolas <span style="font-size:x-small; color:#6464b9; font-family:Consolas ...<<span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas node<span style="font-size:x-small; color:#6464b9; font-family:Consolas <span style="font-size:x-small; color:#6464b9; font-family:Consolas <span style="font-size:x-small; color:#6464b9; font-family:Consolas ><span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas .Elements
<span style="font-size:x-small; color:#0000ff; font-family:Consolas <span style="font-size:x-small; color:#0000ff; font-family:Consolas <span style="font-size:x-small; color:#0000ff; font-family:Consolas Where x<span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; color:#6464b9; font-family:Consolas <span style="font-size:x-small; color:#6464b9; font-family:Consolas <span style="font-size:x-small; color:#6464b9; font-family:Consolas <font face="Consolas" size="2" color="#6464b9" style="font-size:x-small; color:#6464b9; font-family:Consolas mailto:.@id .@ </font> mailto:.@id mailto:.@id mailto:.@id <span style="font-size:x-small; font-family:Consolas mailto:.@id <span style="font-size:x-small; font-family:Consolas id
= someID <span style="font-size:x-small; color:#0000ff; font-family:Consolas <span style="font-size:x-small; color:#0000ff; font-family:Consolas <span style="font-size:x-small; color:#0000ff; font-family:Consolas Select x<span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas ).Single<font face="Consolas" size="2" color="#2b91af" style="font-size:x-small; color:#2b91af; font-family:Consolas


</font>






<span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas then "xel" seems to be a pointer to the relevant element in the XmlDoc, rather than a copy, so that if I update any of the resulting xels child elements,
I seem to actually update the original section in the XmlDoc document. This is very useful when its what I want to do, but not when I want to manipulate a copy of the data without affecting the original!
<span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas How do I reliably get a separate stand-alone copy of an XML node (and its children if appropriate)?
<span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas Apologies if Ive just missed something really simple, and thanks for any help.
<span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas Ade

View the full article
 
Back
Top