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.
|
|
|
|
|
#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);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|