static void Main(string[] args) { // 2, 8, 10, 16 进制转换 int i1 = Convert.ToInt32("1111", 2);//1111转换为10进制 15=2(3)+2(2)+2(1)+2(0) int i2 = Convert.ToInt32("32", 8); //32 转换为10进制 26=3*8(1)+2*8(0) int i3 = Convert.ToInt32("AB", 16); //AB 转换为10进制 171=A*16(1)+B*16(0) System.Console.WriteLine("{0} {1} {2}", i1, i2, i3); string s1 = Convert.ToString(i1, 2); string s2 = Convert.ToString(i2, 8); string s3 = Convert.ToString(i3, 16); System.Console.WriteLine("{0} {1} {2}", s1, s2, s3); System.Console.ReadLine(); }