Reputation: 4861
I want to see, Hello {} in the output, but the following gives compiler errors
Console.WriteLine("{0} \{\}", "Hello");
Upvotes: 2
Views: 921
Reputation: 166406
You need to use double parenthesis.
Something like
string s = String.Format("{0} {{}}", "Hello");
First question at
Upvotes: 5
Reputation:
Using double brackets. See How to escape braces (curly brackets) in a format string in .NET for example.
Upvotes: 2