格式化字符串
对字符串格式化的输出:
Console.WriteLine("两个数相加{0}+{1}={2}",4,6,10);
多重标记
Console.WriteLine("Three integers are {1},{0} and {1}",3,5);
但是标记不能引用超出替换值列表长度以外位置的值
Console.WriteLine("Two integers are {0} and {2}",3,6); //错误
对字符串格式化的输出:
Console.WriteLine("两个数相加{0}+{1}={2}",4,6,10);
Console.WriteLine("Three integers are {1},{0} and {1}",3,5);
但是标记不能引用超出替换值列表长度以外位置的值
Console.WriteLine("Two integers are {0} and {2}",3,6); //错误