This works on my machine:
using System;
using System.Xml.Serialization;
namespace TestStringType {
class Program {
static void Main(string[] args) {
bool a = Object.ReferenceEquals(typeof(string[]), typeof(String[]));
Console.WriteLine(a);
XmlSerializer serializer = new XmlSerializer(typeof(string[]));
XmlSerializer serializer2 = new XmlSerializer(typeof(String[]));
String[] s = { "Hi", "There", "Foo", "Bar" };
Console.WriteLine("string[] serializer:");
serializer.Serialize(Console.Out, s);
Console.WriteLine("\n\nString[] serializer:");
serializer2.Serialize(Console.Out, s);
Console.ReadKey();
}
}
}
Output:
True
string[] serializer:
<?xml version="1.0" encoding="IBM437"?>
<ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="
http://www.w3.org/2001/XMLSchema">
<string>Hi</string>
<string>There</string>
<string>Foo</string>
<string>Bar</string>
</ArrayOfString>
String[] serializer:
<?xml version="1.0" encoding="IBM437"?>
<ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="
http://www.w3.org/2001/XMLSchema">
<string>Hi</string>
<string>There</string>
<string>Foo</string>
<string>Bar</string>
</ArrayOfString>
edit: You're not on .Net 1.1, are you?
Thread Closed
This thread is kinda stale and has been closed but if you'd like to continue the conversation, please create a new thread in our Forums,
or Contact Us and let us know.