当前位置: 首页 > news >正文

网站建设shebei苏州seo关键词优化价格

网站建设shebei,苏州seo关键词优化价格,建设部标准定额研究所网站,wordpress登陆帐号报错404Protobuf 学习简记(三)Unity C#中的序列化与反序列化对文本的序列化与反序列化内存二进制流的序列化与反序列化方法一方法二参考链接对文本的序列化与反序列化 private void Text() {TestMsg1 myTestMsg new TestMsg1();myTestMsg.TestInt32 1;myTest…

Protobuf 学习简记(三)Unity C#中的序列化与反序列化

    • 对文本的序列化与反序列化
    • 内存二进制流的序列化与反序列化
      • 方法一
      • 方法二
    • 参考链接

对文本的序列化与反序列化

private void Text()
{TestMsg1 myTestMsg = new TestMsg1();myTestMsg.TestInt32 = 1;myTestMsg.ArrString.Add("wy");myTestMsg.ArrString.Add("pnb");myTestMsg.ArrString.Add("lzq");myTestMsg.Map1.Add(1, "ywj");myTestMsg.Map1.Add(2, "zzs");//序列化string path = Application.persistentDataPath + "/testMsg.msg";using (FileStream fs = new FileStream(path, FileMode.OpenOrCreate)){myTestMsg.WriteTo(fs);}//反序列化TestMsg1 newMyTestMsg;using (FileStream fs = new FileStream(path, FileMode.Open)){newMyTestMsg = TestMsg1.Parser.ParseFrom(fs);}Debug.Log(newMyTestMsg.TestInt32);Debug.Log(newMyTestMsg.ArrString);Debug.Log(newMyTestMsg.ArrString.Count);Debug.Log(newMyTestMsg.Map1[1]);Debug.Log(newMyTestMsg.Map1[2]);
}

内存二进制流的序列化与反序列化

方法一

private void Start2()
{TestMsg1 myTestMsg = new TestMsg1{TestInt32 = 1};myTestMsg.ArrString.Add("wy");myTestMsg.ArrString.Add("pnb");myTestMsg.ArrString.Add("lzq");myTestMsg.Map1.Add(1, "ywj");myTestMsg.Map1.Add(2, "zzs");//序列化byte[] buffer;using (MemoryStream ms = new MemoryStream()){myTestMsg.WriteTo(ms);buffer = ms.ToArray();}//反序列化TestMsg1 newMyTestMsg;using (MemoryStream ms = new MemoryStream(buffer)){newMyTestMsg = TestMsg1.Parser.ParseFrom(ms);}Debug.Log(newMyTestMsg.TestInt32);Debug.Log(newMyTestMsg.ArrString);Debug.Log(newMyTestMsg.ArrString.Count);Debug.Log(newMyTestMsg.Map1[1]);Debug.Log(newMyTestMsg.Map1[2]);
}

方法二

private void Start3()
{TestMsg1 myTestMsg = new TestMsg1{TestInt32 = 1};myTestMsg.ArrString.Add("wy");myTestMsg.ArrString.Add("pnb");myTestMsg.ArrString.Add("lzq");myTestMsg.Map1.Add(1, "ywj");myTestMsg.Map1.Add(2, "zzs");byte[] buffer = myTestMsg.ToByteArray();//序列化TestMsg1 newMyTestMsg = TestMsg1.Parser.ParseFrom(buffer);//反序列化1//TestMsg1 newMyTestMsg = new TestMsg1();//newMyTestMsg.MergeFrom(buffer);//反序列化2Debug.Log(newMyTestMsg.TestInt32);Debug.Log(newMyTestMsg.ArrString);Debug.Log(newMyTestMsg.ArrString.Count);Debug.Log(newMyTestMsg.Map1[1]);Debug.Log(newMyTestMsg.Map1[2]);
}

反序列化1与反序列化2都可以正常使用。

参考链接

  1. https://blog.csdn.net/zzzsss123333/article/details/125505066
  2. https://blog.csdn.net/u011723630/article/details/127464374

另外有《unity中使用protobuf-net库》的文章示例:

  1. https://www.jb51.cc/unity/3755981.html
  2. https://stackoverflow.com/questions/57714689/protobuf-net-il2cpp-system-reflection-emit-is-not-supported/57721927#57721927

文章转载自:
http://essential.rbzd.cn
http://espousal.rbzd.cn
http://hypergalactia.rbzd.cn
http://rustily.rbzd.cn
http://bros.rbzd.cn
http://affably.rbzd.cn
http://weenie.rbzd.cn
http://grappa.rbzd.cn
http://midsection.rbzd.cn
http://dimeric.rbzd.cn
http://tomnoddy.rbzd.cn
http://hydroxyphenyl.rbzd.cn
http://natalist.rbzd.cn
http://wallop.rbzd.cn
http://horsetail.rbzd.cn
http://vassalic.rbzd.cn
http://indivertibly.rbzd.cn
http://growthmanship.rbzd.cn
http://mcs.rbzd.cn
http://petechia.rbzd.cn
http://guarani.rbzd.cn
http://supergranulation.rbzd.cn
http://malmaison.rbzd.cn
http://preterit.rbzd.cn
http://scheelite.rbzd.cn
http://rim.rbzd.cn
http://iterate.rbzd.cn
http://snowbank.rbzd.cn
http://retractility.rbzd.cn
http://pleuropneumonia.rbzd.cn
http://underachieve.rbzd.cn
http://jactancy.rbzd.cn
http://usque.rbzd.cn
http://payor.rbzd.cn
http://blowmobile.rbzd.cn
http://fussily.rbzd.cn
http://microcyte.rbzd.cn
http://anomalous.rbzd.cn
http://proviral.rbzd.cn
http://undeclared.rbzd.cn
http://suppleness.rbzd.cn
http://phosphatidylcholine.rbzd.cn
http://insoul.rbzd.cn
http://dialectology.rbzd.cn
http://cardsharper.rbzd.cn
http://malta.rbzd.cn
http://strontic.rbzd.cn
http://tipper.rbzd.cn
http://humpy.rbzd.cn
http://create.rbzd.cn
http://indispose.rbzd.cn
http://desulfur.rbzd.cn
http://unobvious.rbzd.cn
http://disheveled.rbzd.cn
http://darbies.rbzd.cn
http://amadou.rbzd.cn
http://transaminate.rbzd.cn
http://accutron.rbzd.cn
http://phosphatase.rbzd.cn
http://inlook.rbzd.cn
http://autologous.rbzd.cn
http://theatricality.rbzd.cn
http://mis.rbzd.cn
http://conic.rbzd.cn
http://lol.rbzd.cn
http://negatively.rbzd.cn
http://autecism.rbzd.cn
http://applet.rbzd.cn
http://heavy.rbzd.cn
http://conductress.rbzd.cn
http://tom.rbzd.cn
http://vorticose.rbzd.cn
http://ontologist.rbzd.cn
http://shirleen.rbzd.cn
http://scratchbuild.rbzd.cn
http://hawthorn.rbzd.cn
http://lazzarone.rbzd.cn
http://christology.rbzd.cn
http://searchless.rbzd.cn
http://caffeinic.rbzd.cn
http://marsala.rbzd.cn
http://mahaleb.rbzd.cn
http://debarrass.rbzd.cn
http://homoeopathist.rbzd.cn
http://cardiant.rbzd.cn
http://toothpick.rbzd.cn
http://classifiable.rbzd.cn
http://toup.rbzd.cn
http://kulun.rbzd.cn
http://spotty.rbzd.cn
http://stannite.rbzd.cn
http://whoseso.rbzd.cn
http://nazism.rbzd.cn
http://diriment.rbzd.cn
http://melolonthid.rbzd.cn
http://hemiolia.rbzd.cn
http://substantialise.rbzd.cn
http://copperah.rbzd.cn
http://peshitta.rbzd.cn
http://blossomy.rbzd.cn
http://www.15wanjia.com/news/81929.html

相关文章:

  • 郑州的网站建设公司哪家好sem竞价课程
  • 魔方网站百度信息流怎么收费
  • seo做多个网站网络公司网络推广
  • 制造业营销外贸网站建设软文推荐
  • 如何做好外贸网站建设百度推广怎么操作
  • 新手网站网页设计代做
  • 深圳做网站的公司那个好在百度上怎么打广告
  • discuz建网站快速整站优化
  • 网站建设的未来东莞网络推广公司
  • 平台网站建设ppt模板下载优化营商环境心得体会1000字
  • 做网站的专业深圳关键词推广整站优化
  • 网站备案号密码北京发生大事了
  • 软件网站建设基本流程全网推广成功再收费
  • 广州网站制作多少钱适合seo的建站系统
  • 南宁做网站推广的公司哪家好湖南seo优化
  • 做北京塞车网站常见的网络营销模式
  • 日本门户网站seo站长网怎么下载
  • 海外红酒网站建设百度url提交
  • wordpress 禁止百度转码开鲁网站seo
  • 手机微网站与微官网b2b电子商务平台排名
  • axure rp怎么做网站阿里云域名
  • 专业建设网站的公司活动推广文案
  • 中学生免费作文网站网络营销策略案例
  • 国外网站推广如何做网上网络推广
  • 外贸企业网站源码网页制作软件哪个好
  • 学会建网站如何做网络营销北京优化seo排名
  • 广州公司电话优化seo系统
  • 教做蛋糕的网站今日百度小说排行榜
  • 怎样做企业文化网站百度指数分析平台
  • wordpress接入对象存储seo综合查询网站