Convert from String to Byte array in C#
September 7, 2010 2 Comments
To convert from a string to a byte[] in C# use the following code:
byte[] newByteArray = System.Text.Encoding.UTF8.GetBytes("Hello World");
You can use UTF8, UTF16 (Unicode), and UTF32 encoding.