/// <summary> /// A prime number (or a prime) is a natural number that has exactly two distinct natural number divisors: 1 and itself. /// </summary> /// <param name="value">Object value</param> /// <returns>Returns true if the value is a prime number.</returns> public static bool IsPrime(this Int32 value) { return(value.AsInt64().IsPrime()); }
/// <summary>Checks whether the value is in range or returns the default value</summary> /// <param name="value">The Value</param> /// <param name="minValue">The minimum value</param> /// <param name="maxValue">The maximum value</param> /// <param name="defaultValue">The default value</param> public static Int32 InRange(this Int32 value, Int32 minValue, Int32 maxValue, Int32 defaultValue) { return((Int32)value.AsInt64().InRange(minValue, maxValue, defaultValue)); }
/// <summary>Checks whether the value is in range</summary> /// <param name="value">The Value</param> /// <param name="minValue">The minimum value</param> /// <param name="maxValue">The maximum value</param> public static bool InRange(this Int32 value, Int32 minValue, Int32 maxValue) { return(value.AsInt64().InRange(minValue, maxValue)); }
/// <summary> /// Determines whether the value is odd /// </summary> /// <param name = "value">The Value</param> /// <returns>true or false</returns> public static bool IsOdd(this Int32 value) { return(value.AsInt64().IsOdd()); }
/// <summary> /// /// </summary> /// <param name="value"></param> /// <returns></returns> public static Int64 Factorial(this Int32 value) { return(value.AsInt64().Factorial()); }
/// <summary> /// Performs the specified action n times based on the underlying Int32 value. /// </summary> /// <param name = "value">The value.</param> /// <param name = "action">The action.</param> public static void Times(this Int32 value, Action action) { //for (Int32 i = 0; i < value; ++i) // action(); value.AsInt64().Times(action); }
/// <summary> /// Converts the value to ordinal String with specified format. (English) /// </summary> /// <param name="value">Object value</param> /// <param name="format">A standard or custom format String that is supported by the object to be formatted.</param> /// <returns>Returns String containing ordinal indicator adjacent to a numeral denoting. (English)</returns> public static String ToOrdinal(this Int32 value, String format) { return(value.AsInt64().ToOrdinal(format)); }
/// <summary> /// Converts the value to ordinal String. (English) /// </summary> /// <param name="value">Object value</param> /// <returns>Returns String containing ordinal indicator adjacent to a numeral denoting. (English)</returns> public static String ToOrdinal(this Int32 value) { return(value.AsInt64().ToOrdinal()); }