XAttribute Constructor (XAttribute)
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Initializes a new instance of the XAttribute class from another XAttribute object.
Assembly: System.Xml.Linq (in System.Xml.Linq.dll)
Parameters
- other
- Type: System.Xml.Linq.XAttribute
An XAttribute object to copy from.
| Exception | Condition |
|---|---|
| ArgumentNullException | The other parameter is Nothing. |
This example demonstrates that creating a deep copy of an XML tree creates a copy, not a clone, of an attribute in the tree.
Dim output As New StringBuilder Dim root1 As XElement = <Root Att1='abc'/> ' Make a deep copy. Dim root2 As XElement = New XElement(root1) If root1.Attribute("Att1") Is root2.Attribute("Att1") Then output.Append("This will not be printed") output.Append(Environment.NewLine) Else output.Append("Creating a deep copy created a new attribute from the original.") output.Append(Environment.NewLine) End If OutputTextBlock.Text = output.ToString()
Show: