mirror of
https://github.com/oliverbooth/X10D
synced 2024-11-09 16:35:42 +00:00
💄Reformat files
This commit is contained in:
parent
e537b9c727
commit
a01ef63ab0
@ -24,7 +24,7 @@
|
|||||||
actual.CompareTo(lower) > 0 && actual.CompareTo(upper) < 0;
|
actual.CompareTo(lower) > 0 && actual.CompareTo(upper) < 0;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the value
|
/// Gets the value
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="value"></param>
|
/// <param name="value"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
/// <param name="obj">The object to convert.</param>
|
/// <param name="obj">The object to convert.</param>
|
||||||
/// <returns>Returns the value converted to <see cref="T"/>.</returns>
|
/// <returns>Returns the value converted to <see cref="T"/>.</returns>
|
||||||
public static T To<T>(this IConvertible obj) =>
|
public static T To<T>(this IConvertible obj) =>
|
||||||
(T) Convert.ChangeType(obj, typeof(T));
|
(T)Convert.ChangeType(obj, typeof(T));
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Converts the object to another type, returning the default value on failure.
|
/// Converts the object to another type, returning the default value on failure.
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="dateOfBirth">The date of birth.</param>
|
/// <param name="dateOfBirth">The date of birth.</param>
|
||||||
public static int Age(this DateTime dateOfBirth) =>
|
public static int Age(this DateTime dateOfBirth) =>
|
||||||
(int) (((DateTime.Today - TimeSpan.FromDays(1) - dateOfBirth.Date).TotalDays + 1) / 365.2425);
|
(int)(((DateTime.Today - TimeSpan.FromDays(1) - dateOfBirth.Date).TotalDays + 1) / 365.2425);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a DateTime representing the first specified day in the current month
|
/// Gets a DateTime representing the first specified day in the current month
|
||||||
@ -147,7 +147,7 @@
|
|||||||
public static long ToUnixTimeStamp(this DateTime time, bool useMillis = false)
|
public static long ToUnixTimeStamp(this DateTime time, bool useMillis = false)
|
||||||
{
|
{
|
||||||
TimeSpan difference = time - UnixEpoch;
|
TimeSpan difference = time - UnixEpoch;
|
||||||
return (long) (useMillis ? difference.TotalMilliseconds : difference.TotalSeconds);
|
return (long)(useMillis ? difference.TotalMilliseconds : difference.TotalSeconds);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
public static class Int16Extensions
|
public static class Int16Extensions
|
||||||
{
|
{
|
||||||
#region TimeSpan Returns
|
#region TimeSpan Returns
|
||||||
|
|
||||||
// TODO change
|
// TODO change
|
||||||
|
|
||||||
public static TimeSpan Days(this ushort number) =>
|
public static TimeSpan Days(this ushort number) =>
|
||||||
@ -85,7 +86,7 @@
|
|||||||
/// <returns>Returns a <see cref="DateTime"/> representing <paramref name="timestamp"/> seconds since the Unix
|
/// <returns>Returns a <see cref="DateTime"/> representing <paramref name="timestamp"/> seconds since the Unix
|
||||||
/// epoch.</returns>
|
/// epoch.</returns>
|
||||||
public static DateTime FromUnixTimestamp(this short timestamp, bool isMillis = false) =>
|
public static DateTime FromUnixTimestamp(this short timestamp, bool isMillis = false) =>
|
||||||
((long) timestamp).FromUnixTimestamp(isMillis);
|
((long)timestamp).FromUnixTimestamp(isMillis);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Converts the <see cref="UInt16"/> to a <see cref="Byte"/>[].
|
/// Converts the <see cref="UInt16"/> to a <see cref="Byte"/>[].
|
||||||
@ -103,7 +104,6 @@
|
|||||||
public static byte[] GetBytes(this short number) =>
|
public static byte[] GetBytes(this short number) =>
|
||||||
BitConverter.GetBytes(number);
|
BitConverter.GetBytes(number);
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Determines if the <see cref="Int16"/> is a prime number.
|
/// Determines if the <see cref="Int16"/> is a prime number.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -111,7 +111,7 @@
|
|||||||
/// <returns>Returns <see langword="true"/> if <paramref name="number"/> is prime, <see langword="false"/>
|
/// <returns>Returns <see langword="true"/> if <paramref name="number"/> is prime, <see langword="false"/>
|
||||||
/// otherwise.</returns>
|
/// otherwise.</returns>
|
||||||
public static bool IsPrime(this short number) =>
|
public static bool IsPrime(this short number) =>
|
||||||
((long) number).IsPrime();
|
((long)number).IsPrime();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets an boolean value that represents this integer.
|
/// Gets an boolean value that represents this integer.
|
||||||
@ -131,4 +131,4 @@
|
|||||||
public static bool ToBoolean(this ushort value) =>
|
public static bool ToBoolean(this ushort value) =>
|
||||||
value != 0;
|
value != 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
public static class Int32Extensions
|
public static class Int32Extensions
|
||||||
{
|
{
|
||||||
#region TimeSpan Returns
|
#region TimeSpan Returns
|
||||||
|
|
||||||
// TODO change
|
// TODO change
|
||||||
|
|
||||||
public static TimeSpan Days(this uint number) =>
|
public static TimeSpan Days(this uint number) =>
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
public static class Int64Extensions
|
public static class Int64Extensions
|
||||||
{
|
{
|
||||||
#region TimeSpan Returns
|
#region TimeSpan Returns
|
||||||
|
|
||||||
// TODO change
|
// TODO change
|
||||||
|
|
||||||
public static TimeSpan Days(this ulong number) =>
|
public static TimeSpan Days(this ulong number) =>
|
||||||
@ -123,7 +124,7 @@
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
long boundary = (long) Math.Floor(Math.Sqrt(number));
|
long boundary = (long)Math.Floor(Math.Sqrt(number));
|
||||||
for (int i = 3; i <= boundary; i += 2)
|
for (int i = 3; i <= boundary; i += 2)
|
||||||
{
|
{
|
||||||
if (number % i == 0)
|
if (number % i == 0)
|
||||||
@ -131,7 +132,7 @@
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@
|
|||||||
throw new ArgumentException("Type provided must be an Enum.", "T");
|
throw new ArgumentException("Type provided must be an Enum.", "T");
|
||||||
}
|
}
|
||||||
|
|
||||||
return (T) Enum.Parse(t, value, ignoreCase);
|
return (T)Enum.Parse(t, value, ignoreCase);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
Loading…
Reference in New Issue
Block a user