Mega Code Archive

 
Categories / C# / Internationalization
 

Convert the passed string to a UTF8 byte array

using System; using System.Text; public static class StringUtilities {     public static Byte[] StringToUTF8ByteArray(string value)     {         Byte[] byteArray = null;         if (!string.IsNullOrEmpty(value))         {             UTF8Encoding encoding = new UTF8Encoding();             byteArray = encoding.GetBytes(value);         }         return byteArray;     } }