Thursday, December 18, 2008

String.Format - how do you escape curly braces

Took me a little bit of googling to find this out...

Basically if you want your output to be "{like INPUT_HERE this}" then you need to use:
string.Format("{{like {0} this}}", input);

i.e. you escape the curly braces by doubling them up.

No comments:

Post a Comment