-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDecimalExtension.cs
42 lines (34 loc) · 953 Bytes
/
DecimalExtension.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using System;
using System.Collections.Generic;
namespace Aya.Extension
{
public static class DecimalExtension
{
#region Round
public static decimal RoundDecimalPoints(this decimal value, int decimalPoints)
{
var result = Math.Round(value, decimalPoints);
return result;
}
public static decimal RoundToTwoDecimalPoints(this decimal value)
{
var result = Math.Round(value, 2);
return result;
}
#endregion
#region Abs
public static decimal Abs(this decimal value)
{
var result = Math.Abs(value);
return result;
}
public static IEnumerable<decimal> Abs(this IEnumerable<decimal> value)
{
foreach (var d in value)
{
yield return d.Abs();
}
}
#endregion
}
}