可以使用DataContractJsonSerializer序列化对象[]的类型吗?
private string TryToSerialize(object toSerialize)
{
try
{
using (System.IO.MemoryStream writer = new System.IO.MemoryStream())
{
System.Runtime.Serialization.Json.DataContractJsonSerializer se =
new System.Runtime.Serialization.Json.DataContractJsonSerializer(typeof(object[]));
ser.WriteObject(writer, toSerialize);
}
}
catch
{
}
}