This works fine:
XDocument xdoc = new XDocument(
new XDeclaration("1.1", "UTF-8", "yes"),
new XProcessingInstruction("foo", "bar"),
new XElement("test"));
But if I change it to pass the "params array" explicitly as an array, it fails with this System.ArgumentException
: Non white space characters cannot be added to content.:
object[] content = new object[] {
new XDeclaration("1.1", "UTF-8", "yes"),
new XProcessingInstruction("foo", "bar"),
new XElement("test")
};
xdoc = new XDocument(content);
Aren't these two examples exactly equivalent? What's going on here?