C# formatting number

c#, formatting

Solution

Found the solution.

{0:#,#.##}

Problem

I need one C# formatting string that will handle those cases: For input of `1234.561` should produce: `1,234.56` For input of `1234` should produce: `1,234` I tried `{0:N0}`, `{0:N2}` and `{0:#.##}`. Doesn't work.

Original source

Related problems