Hi All,
This code sample shows how to convert a string to a byte array and and byte array to string.
//function to convert string to byte array
public static byte[] ConvertStringToByteArray(string stringToConvert)
{
return (new UnicodeEncoding()).GetBytes(stringToConvert);
}
//function to convert byte array to string
public static string ConvertByteArrayToString(byte[] byteArray)
{
return (new UnicodeEncoding()).GetString(byteArray);
}
Regards
Pankaj
Sunday, February 25, 2007
Subscribe to:
Post Comments (Atom)
1 comments:
Hi. When I try to use this in Silverlight 3 I get this error... Error 31 'System.Text.Encoding.GetString(byte[])' is inaccessible due to its protection level
Do you have any ideas?
Thanks Marthinus
Post a Comment