${}代替string.format()

         string s = "";


            s = string.Format("{0}+{1}={2}\t",12,13,12+13);

            int m = 100, n = 101;

            //$"...{值}..{值}...{值}"
            s += $"我{11}岁了,他{22}岁了";

            //有表达式的话, 用"()"包起来
            s += $"我已经{(aa())}岁了,他也{n}了";
            s+= $"我已经{(m>n?0:1)}岁了,他也{n}了";
            Console.WriteLine(s);
            Console.ReadKey();

 

posted @ 2018-01-12 15:30  冲天小肥牛  阅读(176)  评论(0编辑  收藏  举报