using System.Numerics;
namespace Alchemy.Core.Extensions
{
public static class IntExtension
{
///
/// 整出取余
///
///
///
///
public static bool RemainderSuccess(this int timerCount, int timerInterval)
{
return BigInteger.Remainder(new BigInteger(timerCount), new BigInteger(timerInterval)).Equals(0);
}
///
/// 判断是否合规端口
///
///
///
public static bool IsPort(this int param)
{
if (param >= 1 && param <= 65535)
{
return true;
}
else
{
return false;
}
}
///
/// 判断是否合规正整数和零
///
///
///
public static bool IsIntNotNegative(this int param)
{
if (param >= 0)
{
return true;
}
else
{
return false;
}
}
///
/// 判断是否合规月份数
///
///
///
public static bool IsMonth(this int param)
{
if (param >= 1 && param <= 12)
{
return true;
}
else
{
return false;
}
}
///
/// 判断是否合规正整数
///
///
///
public static bool IsIntPositive(this int param)
{
if (param > 0)
{
return true;
}
else
{
return false;
}
}
}
}