Base64序列化和反序列化
2024-10-21 16:32:48
序列化:
Dictionary<string, string> sPara = GetRequestPost(ref parameterStr); string serializeString = JSONUtility.Serialize(sPara);
serializeString = Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(serializeString));
反序列化:
System.Text.UTF8Encoding encoder = new System.Text.UTF8Encoding();
System.Text.Decoder utf8Decode = encoder.GetDecoder();
byte[] todecode_byte = Convert.FromBase64String(base64DataString);
int charCount = utf8Decode.GetCharCount(todecode_byte, , todecode_byte.Length);
char[] decoded_char = new char[charCount];
utf8Decode.GetChars(todecode_byte, , todecode_byte.Length, decoded_char, );
string decodeResult = new String(decoded_char);
Dictionary<string, string> sPara = JSONUtility.Deserialize<Dictionary<string, string>>(decodeResult);
主要用于httpPost协议传输数据。
最新文章
- DBImport v3.3 中文版发布:数据库数据互导及文档生成工具(IT人员必备)
- JS的递归与TCO尾调用优化
- iOS开发——项目需求-快速回到当前界面的顶部
- C#调用ArcGIS REST服务
- Redis_Jedis使用总结
- pycharm 常用设置
- 射频识别技术漫谈(6)&mdash;&mdash;通讯协议概述【worldsing笔记】
- How to read video frames in hadoop?如何在Hadoop中读取视频帧?
- asp.net js调用后台方法
- DescribingDesign Patterns 描述设计模式
- surface pro系统按键+重装系统
- linux sed命令就是这么简单
- Vulkan Tutorial 18 重构交换链
- linux安装lamp环境(linux+apache+mysql+php)
- EF设计模式之code first
- icpc2018-焦作-F Honeycomb bfs
- sublime text3 当运行报错error时,取消显示路径path的方法
- document.domain 跨域问题[转]
- 选股:“均线是水,K线是舟,量是马达!”的选美理念!
- AVR单片机命名规则
热门文章
- Spring的BeanFactory体系结构(一)
- Linux简介——(一)
- Linux 入门记录:五、vi、vim 编辑器
- 跟踪内核启动过程CONFIG_DEBUG_LL【转自】
- 实验室项目.md
- Cause: java.lang.ClassCastException: java.lang.String cannot be cast to org.apache.ibatis.mapping.MappedStatement
- css3属性书写的时候带的一些前缀的意思
- ASP.NET Core Module overview模块概述
- LinkedList 源码分析
- vue css动画