Del via


HOWTO: Convert a String to a Byte Array (byte[])

Just so I don’t forget, here is how to convert a string to a byte array:

System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();

encoding.GetBytes(yourStringHere)

Comments

  • Anonymous
    November 18, 2009
    If you're dealing with non-English languages you might wanna use UTF8/UTF16?