How use {} in format string?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Alexander Vasilevsky

    #1

    How use {} in format string?

    This example
    string.Format(" { {0} }", "bla-bla-bla");

    throw System.FormatEx ception with message 'Input string was not in a correct
    format.'


    http://www.alvas.net - Audio tools for C# and VB.Net developers



  • Jon Skeet [C# MVP]

    #2
    Re: How use {} in format string?

    On Nov 23, 9:56 am, "Alexander Vasilevsky" <al...@alvas.ne twrote:
    This example
    string.Format(" { {0} }", "bla-bla-bla");
    >
    throw System.FormatEx ception with message 'Input string was not in a correct
    format.'
    Double the braces:

    string.Format(" {{ {0} }}", "bla-bla-bla")

    Jon

    Comment

    • Alexander Vasilevsky

      #3
      Re: How use {} in format string?

      Thank You!

      http://www.alvas.net - Audio tools for C# and VB.Net developers


      "Jon Skeet [C# MVP]" <skeet@pobox.co m???????/???????? ? ????????
      ?????????:
      news:36e73e11-12a7-4b53-880f-9b454e3100fc@n2 0g2000hsh.googl egroups.com...
      On Nov 23, 9:56 am, "Alexander Vasilevsky" <al...@alvas.ne twrote:
      >This example
      >string.Format( "{ {0} }", "bla-bla-bla");
      >>
      >throw System.FormatEx ception with message 'Input string was not in a
      >correct
      >format.'
      >
      Double the braces:
      >
      string.Format(" {{ {0} }}", "bla-bla-bla")
      >
      Jon

      Comment

      Working...