CSharp examples for System:String Format
Get Bytes from String
using System;//from w w w . j a va2 s . c om public class Main{ public static byte[] GetBytes(string st) { var bytes = new byte[st.Length * sizeof(char)]; System.Buffer.BlockCopy(st.ToCharArray(), 0, bytes, 0, st.Length); return bytes; } }