How to create a number formatter at application level to format numbers based on different culture?

Viewed 60

I am trying to format numbers based on US base format.

Code :

var data  = String.Format("{0:n" + 2 + "}", 7453215, new CultureInfo("en-US"));

enter image description here Output :

74,53,215.00

Now the problem is I have this line of code at so many places where I am displaying numbers based on different culture so i have to change everwhere.

Is it possible to create some kind of formatter and register it once,change at one place and everywhere that change is applied to format numbers based on culture?

Updated :

var data = String.Format(new CultureInfo("en-US"), "{0:n" + 2 + "}", 7453215); 

Now I am getting correctly formatted number as per US based format but I would like to create common number formatter at application level.

0 Answers
Related