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.
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.
Did you try with "{0:F2}"? I don't think you can use the "#" as pattern.
UPDATE: I was wrong. The "#" is allowed as custom placeholder.