2016-06-28 10:09:11 +02:00
|
|
|
|
namespace Umbraco.Core
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Provides extension methods for System.Decimal.
|
|
|
|
|
|
/// </summary>
|
2017-07-20 11:21:28 +02:00
|
|
|
|
/// <remarks>See System.Decimal on MSDN and also
|
2016-06-28 10:09:11 +02:00
|
|
|
|
/// http://stackoverflow.com/questions/4298719/parse-decimal-and-filter-extra-0-on-the-right/4298787#4298787.
|
|
|
|
|
|
/// </remarks>
|
|
|
|
|
|
public static class DecimalExtensions
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Gets the normalized value.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="value">The value to normalize.</param>
|
|
|
|
|
|
/// <returns>The normalized value.</returns>
|
2019-01-22 18:03:39 -05:00
|
|
|
|
/// <remarks>Normalizing changes the scaling factor and removes trailing zeros,
|
2016-06-28 10:09:11 +02:00
|
|
|
|
/// so 1.2500m comes out as 1.25m.</remarks>
|
|
|
|
|
|
public static decimal Normalize(this decimal value)
|
|
|
|
|
|
{
|
|
|
|
|
|
return value / 1.000000000000000000000000000000000m;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|