string转byte[]:
byte[] byteArray = System.Text.Encoding.Default.GetBytes ( str );
byte[]转string:
string str = System.Text.Encoding.Default.GetString ( byteArray );
foreach (byte b in buf)
{
strBuilderSB.Append(b.ToString("X2") + " ");
}
string转ASCII byte[]:
byte[] byteArray = System.Text.Encoding.ASCII.GetBytes ( str );
ASCII byte[]转string:
string str = System.Text.Encoding.ASCII.GetString ( byteArray );
//十进制转二进制
Console.WriteLine(Convert.ToString(, ));
//十进制转八进制
Console.WriteLine(Convert.ToString(, ));
//十进制转十六进制
Console.WriteLine(Convert.ToString(, ));
//二进制转十进制
Console.WriteLine(Convert.ToInt32(”″, ));
//八进制转十进制
Console.WriteLine(Convert.ToInt32(”″, ));
//十六进制转十进制
Console.WriteLine(Convert.ToInt32(”FF”, ));