ExtensionMethod.NET Home of 876 C#, Visual Basic, F# and Javascript extension methods


Convert a double to a string formatted using the local currency settings.


/// <summary>
/// Extensions for numeric types.
/// </summary>
public static class NumericExtensions
    /// <summary>
    /// Format a double using the local culture currency settings.
    /// </summary>
    /// <param name="value">The double to be formatted.</param>
    /// <returns>The double formatted based on the local culture currency settings.</returns>
    public static string ToLocalCurrencyString(this double value)
        return (String.Format("{0:C}", value));


double test = 145.90;
string testString = test.ToLocalCurrencyString();

Author: Inge Schepers

Submitted on: 11 dec 2007

Language: C#

Type: System.Double

Views: 4890