Simple class for formatting numbers in C#

This class provides formatting decimals and currency.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Utilities.Formatting
{
/// <summary>
///
/// </summary>
public sealed class FormatUtility
{
/// <summary>
///
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public static string FormatCurrency(double value)
{
return value.ToString("C");

}

/// <summary>

///

/// </summary>

/// <param name="value"></param>

/// <returns></returns>

public static string FormatNumber(double value)

{

return value.ToString("N0");

}

/// <summary>

///

/// </summary>

/// <param name="value"></param>

/// <returns></returns>

public static string FormatNumberWithDecimals(double value)

{

return value.ToString("N2");

}

/// <summary>

///

/// </summary>

/// <param name="value"></param>

/// <returns></returns>

public static string FormatPercentage(double value)

{

return string.Format("{0} %", value.ToString("N2")) ;

}

}

}
By [)ia6l0 iii   Popularity  (1397 Views)