如何添加{in String Format c#

L.E*_*.E. 10 c# string

可能重复:
如何以.Net string.format格式字符串格式字符串中的括号转义
{

我试图格式化这样的字符串,{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)