To convert a string to byte[ ] write the following code:
string stringToConvert="Input your string here";
ASCIIEncoding aEncoding = new ASCIIEncoding();
byte[] bytes = new byte[stringToConvert.Length];
//Convert string message to byte[]
bytes = aEncoding.GetBytes(stringToConvert);
string stringToConvert="Input your string here";
ASCIIEncoding aEncoding = new ASCIIEncoding();
byte[] bytes = new byte[stringToConvert.Length];
//Convert string message to byte[]
bytes = aEncoding.GetBytes(stringToConvert);
No comments:
Post a Comment