Skip to content

Instantly share code, notes, and snippets.

@donma
Created August 27, 2018 05:23
Show Gist options
  • Save donma/94127c9e3ffb8091433056a8bb5a77e2 to your computer and use it in GitHub Desktop.
Save donma/94127c9e3ffb8091433056a8bb5a77e2 to your computer and use it in GitHub Desktop.
decimal to string comma.
decimal t1 = 123456.12345M;
decimal t2 = 123456.12345M;
decimal t3 = 12345678901234.123456789M;
Console.WriteLine(t1.ToString("#,###,###.###"));
//123,456.123
Console.WriteLine(t2.ToString("#,###,###.####"));
//123,456.1235
Console.WriteLine(t3.ToString());
//12345678901234.123456789
Console.WriteLine(GetMoneyString(t3));
//12,345,678,901,234.123456789
Console.ReadLine();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment