How to escape brackets using string.Format in C# and VB.NET

Escaping Brackets in String.Format is very simple.
To output a { use {{ and to output a } use }}.

String.Format("Bracketstest: {{{0}}}", "Hello"); // outputs: "Bracketstest: {Hello}"
Please Share us:
Please rate this snippet

2 thoughts on “How to escape brackets using string.Format in C# and VB.NET

Leave a Reply