int i = 0;
Encoding enc = Encoding.ASCII;
string myString = "abcd";
byte[] myBytes = new byte[myString.Length];
foreach (char item in myString.ToCharArray())
{
myBytes[i] = (byte)item;
i++;
}
myString = enc.GetString(myBytes);
enc = Encoding.Unicode;
myString = "入海口凭良心";
byte[] data = enc.GetBytes(myString);
myString = enc.GetString(data);