如何在 Windows phone 8 中将任何类型的 Object 转换为字节数组? [英] How to convert any type of Object into byte array in Windows phone 8?
本文介绍了如何在 Windows phone 8 中将任何类型的 Object 转换为字节数组?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想以字节为单位存储数据.但由于我是 Windows Phone 8 的新手;我不知道该怎么做.
I want to store data in bytes. But as I'm new to Windows Phone 8; I don't know how to do it.
任何形式的帮助将不胜感激..谢谢
Any kind of help will be appreciated.. thanks
推荐答案
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;
这篇关于如何在 Windows phone 8 中将任何类型的 Object 转换为字节数组?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文