这可以很好地工作:
XDocument xdoc = new XDocument(
new XDeclaration("1.1", "UTF-8", "yes"),
new XProcessingInstruction("foo", "bar"),
new XElement("test"));
但是,如果我将其更改为显式地将"params array“作为数组传递:
object[] content = new object[] {
new XDeclaration("1.1", "UTF-8", "yes"),
new XProcessingInstruction("foo", "bar"),
new XElement("test")
};
xdoc = new XDocument(content);
它会失败,错误为:
System.ArgumentException:无法将非空白字符添加到内容中。
这两个例子不是完全等价的吗?这里发生了什么事?
https://stackoverflow.com/questions/1438935
复制相似问题