Possible duplicate:.NET String for C # byte Array
How to convert a String array to byte [] and vice versa? I need strings to be stored in binary storage. Please show an example in both directions. And one more thing: each line can be more than 90 KB.
If you want to use UTF-8 encoding:
// string to byte[] byte[] bytes = Encoding.UTF8.GetBytes(someString); // byte[] to string string anotherString = Encoding.UTF8.GetString(bytes);
, , , , . ( ) encoding, . .
, , , .
Encoding.
Encoding
How to get a consistent representation of string bytes in C # without manually specifying an encoding?