如何在c#应用程序设置中保存byte []

Imr*_*qat 20 c# listview visual-studio-2010 application-settings

我试图在对象列表视图返回的c#应用程序设置中保存一个字节数组(byte []).

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

das*_*ght 25

从字节数组中生成字符串的最常见方法之一是在Base-64中对它们进行编码:

string encoded = System.Convert.ToBase64String(toEncodeAsBytes);
Run Code Online (Sandbox Code Playgroud)

使用

byte[] bytes = System.Convert.FromBase64String(encoded);
Run Code Online (Sandbox Code Playgroud)

把你的字节拿回来.