Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想将一个包含 32 个条目的字节数组(它是一个解密的密码)保存到 localsettings。我没有收到错误,但是当我阅读它时,我只得到一个包含 18 个条目的字节数组!
为什么?
您正在“按原样”存储字节数组;但是您在获取它时使用 UTF8 对其进行编码,而不是您想要的。
这应该会更好;
byte[] passbyte = new byte[32]; // Store localSettings.Values["password"] = passbyte; // Fetch var passwordsecure = localSettings.Values["password"] as byte[];