You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.1 KiB
C#

1 month ago
#region 文件说明
/*-----------------------------------------------------
* c 2024 jdfcd
* CLR 4.0.30319.42000
* DQ.Construction.NewLook.Utility
*
* pnpe
* pnpe@qq.com
* 2024/6/28 10:09:43
*/
#endregion 文件说明
namespace System
{
/// <summary>
/// The number extensions.
/// </summary>
public static class NumberExtensions
{
/// <summary>
/// Tos the fixed.
/// </summary>
/// <param name="t">The t.</param>
/// <returns>A T.</returns>
public static double? ToFixed(this double? t, int len)
{
if (t.HasValue)
{
return Math.Round(t.Value, len);
}
return t;
}
/// <summary>
/// Tos the fixed.
/// </summary>
/// <param name="t">The t.</param>
/// <returns>A T.</returns>
public static double ToFixed(this double t, int len)
{
return Math.Round(t, len);
}
}
}