C#中的{n}运算符
生活随笔
收集整理的這篇文章主要介紹了
C#中的{n}运算符
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
今天學到了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 }總結
以上是生活随笔為你收集整理的C#中的{n}运算符的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: C#学习笔记—了解C#
- 下一篇: Google(谷歌)中国工程研究院 工程