using System;
namespace ConsoleApp2
{
class Program
{
static void Main(string[] args)
{
//十进制转为二进制
string result1 = Convert.ToString(100, 2);
Console.WriteLine(result1);
//十进制转为八进制
string result2 = Convert.ToString(100, 8);
Console.WriteLine(result2);
//十进制转为十六进制
string result3 = Convert.ToString(100, 16);
Console.WriteLine(result3);
//八进制转为二进制
string result4 = Convert.ToString(07, 2);
Console.WriteLine(result4);
//二进制转为十进制
string result5 = Convert.ToString(0b1010, 10);
Console.WriteLine(result5);
//wait
Console.ReadKey();
}
}
}
标签:Convert,Console,进制,C#,ToString,WriteLine,转换,十进制,string
From: https://www.cnblogs.com/cqpanda/p/17475313.html