Attention: We are retiring the ASP.NET Community Blogs. Learn more >

IFormatProvider whackiness

While visiting the Holy Place today I stopped in to visit some random links in the .NET Framework section (as you do).  One of my mouse-clicks happened to land on the section which talks about FormatProvider's and illustrated the results that various format strings have on the output of ToString.  Here's a demo that I think is particularly cool:

 

string myString = String.Format( "{0:##;(##);nix}, {1:##;(##)}, {2:##;(##);nix}", 44, -44, 0 ) ;
Label1.Text = myString ;  // Displays: 44, (44), nix

No Comments