How to escape brackets in a format string in .Net

Posted by Pop Catalin on Stack Overflow See other posts from Stack Overflow or by Pop Catalin
Published on 2008-09-18T10:04:48Z Indexed on 2010/03/22 10:11 UTC
Read the original article Hit count: 329

Filed under:
|
|
|
|

How can brackets be escaped in a C# format string so, something like :

String val = "1,2,3"
String.Format(" foo {{0}}", val);

doesn't throw a parse exception but actually outputs the string " foo {1,2,3}"

Is there a way to escape the brackets or should a workaround be used.

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET