C# xml中混合的属性和元素
我需要在下面的结构中创建一个xmlC# xml中混合的属性和元素,c#,xml,C#,Xml,我需要在下面的结构中创建一个xml <ipaddress> "10.10.10.10" </ipaddress> <PipeId pid = "4598702C-691E">testvalue</PipeId> --how to display this? <name> "testname" </name> 如果您只是尝试构建该元素,则需要: new XElement("PipeId",
<ipaddress> "10.10.10.10" </ipaddress>
<PipeId pid = "4598702C-691E">testvalue</PipeId> --how to display this?
<name> "testname" </name>
如果您只是尝试构建该元素,则需要:
new XElement("PipeId", // Name of the element
new XAttribute("pid", "4598702C-691E"), // Attribute of the element
"testvalue") // Text content of the element
“显示”是什么意思?我的意思是“如何将其写入xml?”
new XElement("PipeId", // Name of the element
new XAttribute("pid", "4598702C-691E"), // Attribute of the element
"testvalue") // Text content of the element