Sponsored Ad

Sunday, March 13, 2011

How add Currency (Dollar) Sign to a Number using C#

This program will help you to add dollars sign before a number using C#. You can add another currency sign but you need to pass appropriate culture information. for example for us dollars pass en-US

How add Currency (Dollar) Sign to a Number using C#

C# Sample code to add $

using System;
using System.Globalization;
namespace MyApp
{
    class formatting_class
    {
        static void Main()
        {
            decimal Money = 100.20M;

            Console.WriteLine(Money.ToString("c", new CultureInfo("en-US")));

            Console.Read();
        }
    }
}

No comments:

Post a Comment

Sponsored Ad

Development Updates