How do you convert string to byte[] in C#?
using byte[] data = Encoding.UTF8.GetBytes(myString);
Note that .NET strings are encoded as Unicode (UTF-16):
byte[] bytes = Encoding.Unicode.GetBytes("a string");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With