积极答复者
文本转二进制,二进制转文本该怎么处理?

问题
答案
-
//二进制转字符串: private string ConvertToString(byte[] thebyte) { char[] Chars = new char[System.Text.Encoding.Default.GetCharCount(thebyte, 0, thebyte.Length)]; System.Text.Encoding.Default.GetChars(thebyte, 0, thebyte.Length, Chars, 0); string newString = new string(Chars); return newString; } //字符串转二进制: private byte[] ConvertToByte(string theString) { byte[] byteStream = System.Text.Encoding.Default.GetBytes(theString); return byteStream; }
http://blog.csdn.net/zx13525079024- 已标记为答案 ThankfulHeartModerator 2010年11月18日 1:08
全部回复
-
//二进制转字符串: private string ConvertToString(byte[] thebyte) { char[] Chars = new char[System.Text.Encoding.Default.GetCharCount(thebyte, 0, thebyte.Length)]; System.Text.Encoding.Default.GetChars(thebyte, 0, thebyte.Length, Chars, 0); string newString = new string(Chars); return newString; } //字符串转二进制: private byte[] ConvertToByte(string theString) { byte[] byteStream = System.Text.Encoding.Default.GetBytes(theString); return byteStream; }
http://blog.csdn.net/zx13525079024- 已标记为答案 ThankfulHeartModerator 2010年11月18日 1:08