如何在C#应用程序设置中保存byte [] [英] How to save byte[] in c# application settings

查看:89
本文介绍了如何在C#应用程序设置中保存byte []的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在对象列表视图.

谁能给我一个关于如何在c#应用程序设置中保存字节数组的解决方案?或关于如何将byte []转换为类似字符串然后存储,然后检索并再次将其转换为字节数组并将其返回给对象列表视图的一些技巧.

Can anyone give me a solution on how to save byte array in c# application settings? or some trick on how to convert byte[] to something like a string then store, then retrieve and again convert it to byte array and give it back to object list view.

推荐答案

从字节数组中生成字符串的最常见方法之一是在

One of the most common ways to make a string from an array of bytes is encoding them in Base-64:

string encoded = System.Convert.ToBase64String(toEncodeAsBytes);

使用

byte[] bytes = System.Convert.FromBase64String(encoded);

找回字节数.

这篇关于如何在C#应用程序设置中保存byte []的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆