我试图格式化这样的字符串,{Enum.Enum1,"Enum1String"}我试过这段代码
foreach (KeyValuePair<int, string> p in Helper.Dict)
{
// file.WriteLine(string.Format("{0} | {1}",p.Key,p.Value));
file.WriteLine(string.Format("{Enum.{0},\"{1}\"}", p.Value,p.Value));
}
Run Code Online (Sandbox Code Playgroud)
但它不起作用.如何以字符串格式添加{ 我在想使用stringbuilder.
M.B*_*ock 27
从这个MSDN FAQ:
string s = String.Format("{{ hello to all }}");
Console.WriteLine(s); //prints '{ hello to all }'
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
15273 次 |
| 最近记录: |