Reputation: 14684
i know how to save a string into the IsolatedStorageFile
but what about a byte[]
?
for a string i do:
string enc = "myString";
using (var iso = IsolatedStorageFile.GetUserStoreForApplication())
{
using (var stream = iso.OpenFile("fileName", FileMode.Create))
{
var writer = new StreamWriter(stream);
writer.Write(enc);
writer.Close();
}
}
EDIT: okay i know now how to write, but how to read out the byte[] again?
Upvotes: 1
Views: 756
Reputation: 39007
To write a byte array, instead of enclosing your stream in a StreamWriter, use directly stream.Write
. Or use a BinaryWriter.
For instance:
stream.Write(byteArray, 0, byteArray.Length);
Upvotes: 2