Heinz
Wed Dec 17 09:13:49 CST 2003
TYVM, I thought it would be something like this but I didn't want to try all
the possibilities and I couldn't find it in the online documentation.
Tom
"Jon Skeet [C# MVP]" <skeet@pobox.com> wrote in message
news:MPG.1a4a3303a522b456989c55@msnews.microsoft.com...
> Heinz Kiosk <removethis.tom.mcclelland@ntlworld.com> wrote:
> > How do you escape a { in a format string for string.Format?
> >
> > I want to have a format string that builds code, something like "static
void
> > {0}() { {1} }". I know there are other solutions like building the {1}
with
> > the brackets.
>
> You need to just double the brace. For instance:
>
> Console.WriteLine ("static void {0} {{ {1} }}",
> "Foo", "Bar();");
>
> produces:
>
> static void Foo { Bar(); }
>
> --
> Jon Skeet - <skeet@pobox.com>
>
http://www.pobox.com/~skeet
> If replying to the group, please do not mail me too