Monday, October 5, 2009

Code: C# Escaping Curly Braces in String.Format

With the Format() method of String in C#, you use numbered braces to denote replacement positions.  If you want to display braces in your formatted text you need to escape them by entering the brace twice:

String.Format("{{ Go to {0} for help}}", "");