C#占位符

可以识别字符串中占位符的函数Console.WriteLine()和string.Format()

public static void Main()
        {
            int  a = 5;
            string b = "6";
            string c = "{0}和{1}";
            Console.WriteLine(c,a,b);
            string d= string.Format(c,a,b);
            Console.WriteLine(d);
            Console.ReadKey();
        }

image

posted @ 2015-07-09 22:31  Valentino  阅读(4915)  评论(0编辑  收藏  举报