Exemple #1
0
 /// <summary>
 /// Converts the value to ordinal string. (English)
 /// </summary>
 /// <param name="i">Object value</param>
 /// <returns>Returns string containing ordinal indicator adjacent to a numeral denoting. (English)</returns>
 public static string ToOrdinal(this int i)
 {
     return i.AsLong().ToOrdinal();
 }
Exemple #2
0
 /// <summary>
 /// Converts the value to ordinal string with specified format. (English)
 /// </summary>
 /// <param name="i">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 int i, string format)
 {
     return i.AsLong().ToOrdinal(format);
 }
Exemple #3
0
 /// <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 int InRange(this int value, int minValue, int maxValue, int defaultValue)
 {
     return (int)value.AsLong().InRange(minValue, maxValue, defaultValue);
 }
Exemple #4
0
 /// <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="candidate">Object value</param>
 /// <returns>Returns true if the value is a prime number.</returns>
 public static bool IsPrime(this int candidate)
 {
     return candidate.AsLong().IsPrime();
 }
Exemple #5
0
 /// <summary>
 /// 	Determines whether the value is odd
 /// </summary>
 /// <param name = "value">The Value</param>
 /// <returns>true or false</returns>
 public static bool IsOdd(this int value)
 {
     return value.AsLong().IsOdd();
 }
Exemple #6
0
 /// <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 int value, int minValue, int maxValue)
 {
     return value.AsLong().InRange(minValue, maxValue);
 }
Exemple #7
0
 /// <summary>
 /// 	Performs the specified action n times based on the underlying int value.
 /// </summary>
 /// <param name = "value">The value.</param>
 /// <param name = "action">The action.</param>
 public static void Times(this int value, Action action)
 {
     value.AsLong().Times(action);
 }
Exemple #8
0
 /// <summary>
 /// 	Determines whether the value is even
 /// </summary>
 /// <param name = "value">The Value</param>
 /// <returns>true or false</returns>
 public static bool IsEven(this int value)
 {
     return value.AsLong().IsEven();
 }
Exemple #9
0
 public static TimeSpan AsTimeSpan(this string from)
 {
     return new TimeSpan(from.AsLong());
 }
Exemple #10
0
 public static DateTime AsDateTime(this string from)
 {
     return DateTime.FromBinary(from.AsLong());
 }
 internal static bool Get(this JsonData data, ref long val)
 {
     bool ret = false;
       if (null != data && (data.IsDouble || data.IsInt || data.IsLong)) {
     ret = true;
     val = data.AsLong();
       }
       return ret;
 }
 internal static ulong AsUlong(this JsonData data)
 {
     return (ulong)data.AsLong();
 }
 public static long AsLong(this string str, long defaultValue)
 {
     long value = str.AsLong();
     return value == long.MinValue ? defaultValue : value;
 }
        public static long? AsNullableLong(this string inputValue)
        {
            if (string.IsNullOrWhiteSpace(inputValue))
            {
                return null;
            }

            return inputValue.AsLong();
        }
Exemple #15
0
 public static TimeSpan AsTimeSpan(this byte[] from)
 {
     return new TimeSpan(from.AsLong());
 }