How to include parenthesis for AS-IS output in format string
I want to see, Hello {} in the output, but the following gives compiler errors
Console.WriteLine(开发者_如何学C"{0} \{\}", "Hello");
You need to use double parenthesis.
Something like
string s = String.Format("{0} {{}}", "Hello");
First question at
String Formatting FAQ
Using double brackets. See How to escape braces (curly brackets) in a format string in .NET for example.
Console.WriteLine("{0} {{}}", "Hello");
精彩评论