String.Format("{0:n}", 1234); // Output: 1,234.00
String.Format("{0:n0}", 9876); // No digits after the decimal point. Output: 9,876
我发现这是最简单的方法:
myInteger.ToString("N0")
int number = 1000000000;
string whatYouWant = number.ToString("#,##0");
//You get: 1,000,000,000