C# 窗体在线2,8,16进制转换以及,在线更新时间
class Program { static void Main(string[] args) { //十进制转二进制 Console.WriteLine("十进制166的二进制表示: " + Convert.ToString(166, 2)); //十进制转八进制 Console.WriteLine("十进制166的八进制表示: " + Convert.ToString(166, 8)); //十进制转十六进制 Console.WriteLine("十进制166的十六进制表示: " + Convert.ToString(166, 16)); Timer t = new Timer(); t.Elapsed += new ElapsedEventHandler(writesecond); t.Interval = 1000; t.Enabled = true; Console.ReadLine(); } public static void writesecond(object source, ElapsedEventArgs e) { Console.Clear(); Console.WriteLine("当前秒数:" + DateTime.Now.ToString()); } }
初入江湖程序猿