![](/img/trans.png)
[英]How do I use c# XMLSerializer to create an XML request that can allow multple child elements with the same name but not as an array
[英]WCF - how to create multiple elements in request with same name
嘗試這個
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.Xml.Linq;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
XNamespace ns = "abc";
XElement request = new XElement(ns + "Request", new object[] {
new XElement(ns + "Cont"),
new XElement(ns + "Lea"),
new XElement(ns + "Deal"),
new XElement(ns + "Esc"),
new XElement(ns + "Esc"),
new XElement(ns + "Esc"),
new XElement(ns + "Esc"),
new XElement(ns + "Esc"),
new XElement(ns + "Part"),
new XElement(ns + "Veh")
});
}
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.