Ste*_*ieB -2 c# string-formatting
例如,在以下示例中:
string commandText = string.Format("Select * from {0}", filename);
Run Code Online (Sandbox Code Playgroud)
以上是如何工作的?
{0}
指的是传入的第二个参数String.Format
。{1}
指第三、{2}
第四等,例如:
String.Format("The {0} brown {1} jumps {2} the {3} dog.", "quick", "fox", "over", "lazy")
Run Code Online (Sandbox Code Playgroud)
评估为
"The quick brown fox jumps over the lazy dog."
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
10814 次 |
最近记录: |