Tim Huffam

Dotting the I and crossing the T of I.T.

  Home  |   Contact  |   Syndication    |   Login
  152 Posts | 0 Stories | 2310 Comments | 653 Trackbacks

News

Archives

Post Categories

Interesting Blogs/Links

June 2005 Entries

This is something I wanted to do a while ago.. and ended up coding manually (duh!) like this: string myString = "a test string";byte[] myByteArray = new byte[myString.Length];int i = 0;foreach(char c in InStr.ToCharArray()){ myByteArray [i] = (byte)c; i++;} Then some kind soul (thanks Michael) mentioned the Encoding class <slaps forehead>... System.Text.Encoding enc = System.Text.Encoding.ASCII;... myByteArray = enc.GetBytes("a text string);string myString = enc.GetString(myByteArray );...
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati