我想以字节为单位存储数据。但是,因为我是Windows Phone 8的新手;我不知道怎么做。
任何形式的帮助将不胜感激..谢谢
答案 0 :(得分:2)
DataContractSerializer serializer = new DataContractSerializer(typeof(List<Dictionary<String, String>>));
byte[] byteArr;
using (var ms = new System.IO.MemoryStream())
{
serializer.WriteObject(ms, stringlist);
byteArr = ms.ToArray();
}
return byteArr;
答案 1 :(得分:2)
System.Runtime.Serialization.DataContractSerializer serializer = new System.Runtime.Serialization.DataContractSerializer(typeof(List<Dictionary<String, String>>));
List<Dictionary<String, String>> stringlist;
using (var ms = new System.IO.MemoryStream(byteArr))
{
stringlist = (List<Dictionary<String, String>>)serializer.ReadObject(ms);
}
return stringlist;
此代码有助于将您的数据恢复到原始状态。我认为这就是你要求的