int a = 10; Console.WriteLine(a.ToString("X")); //10进制转16进制 Console.WriteLine(Convert.ToString(a, 16)); //10进制转16进制 Console.WriteLine(Convert.ToString(a, 2)); //10进制转2进制 string b = "1010"; Console.WriteLine(Convert.ToInt32(b, 2)); //2进制转10进制 Console.WriteLine(string.Format("{0:X}", Convert.ToInt32(b, 2)));//2进制转16进制 int c = 0x0a; Console.WriteLine(Convert.ToString(c, 2)); //16进制转2进制 Console.WriteLine(Convert.ToString(c, 10)); //16进制转10进制