标签:os ar new type app ui js on
public static string ConvertToJsonString<T>(T instance)
{ using (MemoryStream stream = new MemoryStream())
{
DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(T));
serializer.WriteObject(stream, instance);
StringBuilder sb = new StringBuilder();
sb.Append(Encoding.UTF8.GetString(stream.ToArray(), 0, stream.ToArray().Length));
return sb.ToString();
}
}
标签:os ar new type app ui js on
原文地址:http://www.cnblogs.com/Wolfmanlq/p/3906639.html