Why doesn't this code work correctly? Do do I misunderstand something?
System.Console.WriteLine("{{{0:c}}}", 12323.09m);
Real output:
{c}
Expected output:
{$12,323.09}
Why doesn't this code work correctly? Do do I misunderstand something?
System.Console.WriteLine("{{{0:c}}}", 12323.09m);
Real output:
{c}
Expected output:
{$12,323.09}
 
    
     
    
    The issue is that {{{0:c}}} is parsed as {{ { ... }} }, and not as {{ { ... } }}.
Try
System.Console.WriteLine("{{{0:c}{1}", 12323.09m, '}');
Or see a similar sample in MSDN (see Escaping Braces):
int value = 6324;
string output = string.Format("{0}{1:D}{2}", 
                              "{", value, "}");
Console.WriteLine(output);
 
    
    Try this:
System.Console.WriteLine("{" + String.Format("{0:C}", 12323.09) + "}");
