using (System.IO.MemoryStream ms = new System.IO.MemoryStream())
{
using (System.IO.StreamWriter writer = new System.IO.StreamWriter(ms, Encoding.GetEncoding("UTF-16")))
{
new System.Xml.Serialization.XmlSerializer(typeof(ViewProcess)).Serialize(writer, vp);
string s = Encoding.GetEncoding("UTF-16").GetString(ms.ToArray());
System.Diagnostics.Debug.Print(s);
}
}
using (System.IO.MemoryStream ms = new System.IO.MemoryStream(System.Text.Encoding.GetEncoding("UTF-16").GetBytes(s)))
{
if (new System.Xml.Serialization.XmlSerializer(typeof(ViewProcess)).Deserialize(ms) is ViewProcess vp)
{
}
}