mirror of
https://github.com/nsnail/ns-ext.git
synced 2025-06-20 09:38:16 +08:00
refactor: ♻️ 2.0 (#3)
This commit is contained in:
26
src/backend/NSExt/Extensions/DecimalExtensions.cs
Normal file
26
src/backend/NSExt/Extensions/DecimalExtensions.cs
Normal file
@ -0,0 +1,26 @@
|
||||
namespace NSExt.Extensions;
|
||||
|
||||
/// <summary>
|
||||
/// DecimalExtensions
|
||||
/// </summary>
|
||||
public static class DecimalExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// 四舍五入后的近似值
|
||||
/// </summary>
|
||||
/// <param name="me">me</param>
|
||||
/// <param name="place">小数点位数</param>
|
||||
/// <returns>处理后的值</returns>
|
||||
public static decimal Round(this decimal me, int place)
|
||||
{
|
||||
return Math.Round(me, place);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ToString 的 Invariant 版本
|
||||
/// </summary>
|
||||
public static string ToInvString(this decimal me)
|
||||
{
|
||||
return me.ToString(CultureInfo.InvariantCulture);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user