今天学到了C#中的{n}运算符,感觉这个运算符就是对C++中%d运算符的一种改进,

因为{n}运算符能够指定替换列表中的第几个,就比%d之类的运算符操作起来省力很多。

我的例程:

 1 using System;
 2 using System.Collections.Generic;
 3 using System.Linq;
 4 using System.Text;
 5 
 6 namespace braceApplication
 7 {
 8     class Program
 9     {
10         static void Main(string[] args)
11         {
12             string str1 = "str1";
13             string str2 = "str2";
14 
15             Console.WriteLine("{0}, {1}, {0}, {1}", str1, str2);
16 
17             Console.ReadLine();
18 
19 
20         }
21     }
22 }
 posted on 2012-10-26 12:00  Jiang, X.  阅读(475)  评论(0编辑  收藏  举报