Does anybody have sample code to convert from binary data to string in c#?
-
Take note here, if your data is binary because it is encrypted, you must decrypt it before you can read it's data.rlb.usa– rlb.usa2010-06-09 15:32:34 +00:00Commented Jun 9, 2010 at 15:32
-
With binary data, you mean a byte array (byte[])?Koen– Koen2010-06-09 15:32:39 +00:00Commented Jun 9, 2010 at 15:32
-
What are you trying to accommplish? We could go about this any many ways and most will be the wrong way if we don't have more information about what you are trying to accomplish and what is in the binary data. We could decode it by parsing the data, or we could encode it in base64, or decode it to unicode. What does the binary data represent?AaronLS– AaronLS2010-06-09 16:50:44 +00:00Commented Jun 9, 2010 at 16:50
Add a comment
|
3 Answers
If your binary data is stored in byte array and you want to convert it to Base64-encoding, you can use Convert.ToBase64String method:
var base64String = Convert.ToBase64String(yourBinaryDataHere);