in c# code console.writeline("{0:c}", 998);
gives output $998
in default "us-language" settings. if want dynamically change currency symbol pound, sterling, rupee or currency symbol depending upon user preference, there way around this. say, call method:
public void printinrightcurrencyformat(decimal value, icustomformatter format) { console.writeline( ... ... ... ); }
and method print value in required format.
one more thing is there way insert custom currency symbol. point if currency comes new symbol(like india did rupee symbol), how enable in code.
thank in advance.
you use culture:
console.writeline(string.format(new cultureinfo("en-gb"), "{0:c}", value));
or set current thread culture user preference , print value:
thread.currentthread.currentculture = new cultureinfo("en-gb"); console.writeline("{0:c}", value);
Comments
Post a Comment