如何忽略{字符?

gru*_*ber 2 .net c#

我想忽略{字符串中的字符是否可能?

感谢帮助

String.Format("function(s, e) {  {0}.PerformCallback(MyObject.GetSelectedItem().value); }", getClientName);
Run Code Online (Sandbox Code Playgroud)

Fré*_*idi 6

你必须加倍花括号才能逃脱它们:

String.Format(CultureInfo.InvariantCulture, @"
    function(s, e) {{
        {0}.PerformCallback(MyObject.GetSelectedItem().value);
    }}", getClientName);
Run Code Online (Sandbox Code Playgroud)