Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/276.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# xml中混合的属性和元素_C#_Xml - Fatal编程技术网

C# xml中混合的属性和元素

C# 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",

我需要在下面的结构中创建一个xml

<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