private static byte[] StringToByteArray(string stringToConvert) { byte[] bytes = new byte[stringToConvert.Length * sizeof(char)]; System.Buffer.BlockCopy(stringToConvert.ToCharArray(), 0, bytes, 0, bytes.Length); return bytes; }