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

原文地址:https://www.cnblogs.com/wllhq/p/4634420.html