You can use .NET's Composite Formatting to format the currency as shown below
Double Incentive = 234.45; Console.WriteLine("The agreed incentive in local currency is {0:C} ", Incentive);
If you want to convert it into dollars/pounds etc you need to change the culture info :
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US", false); Console.WriteLine("The agreed incentive in USD is {0:C} ", Incentive); Thread.CurrentThread.CurrentCulture = new CultureInfo("en-GB", false); Console.WriteLine("The agreed incentive in GBP is {0:C} ", Incentive);
The above code needs the following directives
using System.Threading; using System.Globalization;
No comments:
Post a Comment