💩 Deprecating API found in Humanizer package

This commit is contained in:
Oliver Booth 2019-12-18 13:04:23 +00:00
parent 4c94fd32a6
commit 33fff6be51
No known key found for this signature in database
GPG Key ID: 0D7F2EF1C8D2B9C0
5 changed files with 216 additions and 0 deletions

View File

@ -77,6 +77,10 @@
/// Gets a <see cref="DateTime"/> representing midnight on the current date.
/// </summary>
/// <param name="current">The current date.</param>
[Obsolete(
"This method has been deprecated in favor of Humanizer's fluent DateTime API. " +
"Please consider downloading the Humanizer package for more stable implementations of this method."
)]
public static DateTime Midnight(this DateTime current)
{
return new DateTime(current.Year, current.Month, current.Day, 0, 0, 0);
@ -105,6 +109,10 @@
/// Gets a <see cref="DateTime"/> representing noon on the current date.
/// </summary>
/// <param name="current">The current date.</param>
[Obsolete(
"This method has been deprecated in favor of Humanizer's fluent DateTime API. " +
"Please consider downloading the Humanizer package for more stable implementations of this method."
)]
public static DateTime Noon(this DateTime current)
{
return new DateTime(current.Year, current.Month, current.Day, 12, 0, 0);
@ -129,6 +137,10 @@
/// <param name="date">The <see cref="DateTime"/> to copy.</param>
/// <param name="year">The year to set.</param>
/// <returns>Returns a <see cref="DateTime"/>.</returns>
[Obsolete(
"This method has been deprecated in favor of Humanizer's fluent DateTime API. " +
"Please consider downloading the Humanizer package for more stable implementations of this method."
)]
public static DateTime WithYear(this DateTime date, int year)
{
return new DateTime(year, date.Month, date.Day, date.Hour, date.Minute, date.Second, date.Millisecond);
@ -140,6 +152,10 @@
/// <param name="current">The current date.</param>
/// <param name="hour">The hour.</param>
/// <param name="minute">The minute.</param>
[Obsolete(
"This method has been deprecated in favor of Humanizer's fluent DateTime API. " +
"Please consider downloading the Humanizer package for more stable implementations of this method."
)]
public static DateTime WithTime(this DateTime current, int hour, int minute)
{
return current.WithTime(hour, minute, 0);
@ -153,6 +169,10 @@
/// <param name="minute">The minute.</param>
/// <param name="second">The second.</param>
/// <returns></returns>
[Obsolete(
"This method has been deprecated in favor of Humanizer's fluent DateTime API. " +
"Please consider downloading the Humanizer package for more stable implementations of this method."
)]
public static DateTime WithTime(this DateTime current, int hour, int minute, int second)
{
return current.WithTime(hour, minute, second, 0);
@ -166,6 +186,10 @@
/// <param name="minute">The minute.</param>
/// <param name="second">The second.</param>
/// <param name="millisecond">The millisecond.</param>
[Obsolete(
"This method has been deprecated in favor of Humanizer's fluent DateTime API. " +
"Please consider downloading the Humanizer package for more stable implementations of this method."
)]
public static DateTime WithTime(this DateTime current, int hour, int minute, int second, int millisecond)
{
return new DateTime(current.Year, current.Month, current.Day, hour, minute, second, millisecond);

View File

@ -15,61 +15,109 @@
// TODO change
[Obsolete(
"This method has been deprecated in favor of Humanizer's fluent DateTime API. " +
"Please consider downloading the Humanizer package for more stable implementations of this method."
)]
public static TimeSpan Days(this ushort number)
{
return TimeSpan.FromDays(number);
}
[Obsolete(
"This method has been deprecated in favor of Humanizer's fluent DateTime API. " +
"Please consider downloading the Humanizer package for more stable implementations of this method."
)]
public static TimeSpan Hours(this ushort number)
{
return TimeSpan.FromHours(number);
}
[Obsolete(
"This method has been deprecated in favor of Humanizer's fluent DateTime API. " +
"Please consider downloading the Humanizer package for more stable implementations of this method."
)]
public static TimeSpan Milliseconds(this ushort number)
{
return TimeSpan.FromSeconds(number);
}
[Obsolete(
"This method has been deprecated in favor of Humanizer's fluent DateTime API. " +
"Please consider downloading the Humanizer package for more stable implementations of this method."
)]
public static TimeSpan Minutes(this ushort number)
{
return TimeSpan.FromMinutes(number);
}
[Obsolete(
"This method has been deprecated in favor of Humanizer's fluent DateTime API. " +
"Please consider downloading the Humanizer package for more stable implementations of this method."
)]
public static TimeSpan Seconds(this ushort number)
{
return TimeSpan.FromSeconds(number);
}
[Obsolete(
"This method has been deprecated in favor of Humanizer's fluent DateTime API. " +
"Please consider downloading the Humanizer package for more stable implementations of this method."
)]
public static TimeSpan Ticks(this ushort number)
{
return TimeSpan.FromTicks(number);
}
[Obsolete(
"This method has been deprecated in favor of Humanizer's fluent DateTime API. " +
"Please consider downloading the Humanizer package for more stable implementations of this method."
)]
public static TimeSpan Days(this short number)
{
return TimeSpan.FromDays(number);
}
[Obsolete(
"This method has been deprecated in favor of Humanizer's fluent DateTime API. " +
"Please consider downloading the Humanizer package for more stable implementations of this method."
)]
public static TimeSpan Hours(this short number)
{
return TimeSpan.FromHours(number);
}
[Obsolete(
"This method has been deprecated in favor of Humanizer's fluent DateTime API. " +
"Please consider downloading the Humanizer package for more stable implementations of this method."
)]
public static TimeSpan Milliseconds(this short number)
{
return TimeSpan.FromSeconds(number);
}
[Obsolete(
"This method has been deprecated in favor of Humanizer's fluent DateTime API. " +
"Please consider downloading the Humanizer package for more stable implementations of this method."
)]
public static TimeSpan Minutes(this short number)
{
return TimeSpan.FromMinutes(number);
}
[Obsolete(
"This method has been deprecated in favor of Humanizer's fluent DateTime API. " +
"Please consider downloading the Humanizer package for more stable implementations of this method."
)]
public static TimeSpan Seconds(this short number)
{
return TimeSpan.FromSeconds(number);
}
[Obsolete(
"This method has been deprecated in favor of Humanizer's fluent DateTime API. " +
"Please consider downloading the Humanizer package for more stable implementations of this method."
)]
public static TimeSpan Ticks(this short number)
{
return TimeSpan.FromTicks(number);

View File

@ -21,6 +21,10 @@
/// <param name="hour">The hour.</param>
/// <param name="minute">The minute.</param>
/// <param name="second">The second.</param>
[Obsolete(
"This method has been deprecated in favor of Humanizer's fluent DateTime API. " +
"Please consider downloading the Humanizer package for more stable implementations of this method."
)]
public static DateTime January(this int day, int year, int hour = 0, int minute = 0, int second = 0)
{
return new DateTime(year, 1, day, hour, minute, second);
@ -34,6 +38,10 @@
/// <param name="hour">The hour.</param>
/// <param name="minute">The minute.</param>
/// <param name="second">The second.</param>
[Obsolete(
"This method has been deprecated in favor of Humanizer's fluent DateTime API. " +
"Please consider downloading the Humanizer package for more stable implementations of this method."
)]
public static DateTime February(this int day, int year, int hour = 0, int minute = 0, int second = 0)
{
return new DateTime(year, 2, day, hour, minute, second);
@ -47,6 +55,10 @@
/// <param name="hour">The hour.</param>
/// <param name="minute">The minute.</param>
/// <param name="second">The second.</param>
[Obsolete(
"This method has been deprecated in favor of Humanizer's fluent DateTime API. " +
"Please consider downloading the Humanizer package for more stable implementations of this method."
)]
public static DateTime March(this int day, int year, int hour = 0, int minute = 0, int second = 0)
{
return new DateTime(year, 3, day, hour, minute, second);
@ -60,6 +72,10 @@
/// <param name="hour">The hour.</param>
/// <param name="minute">The minute.</param>
/// <param name="second">The second.</param>
[Obsolete(
"This method has been deprecated in favor of Humanizer's fluent DateTime API. " +
"Please consider downloading the Humanizer package for more stable implementations of this method."
)]
public static DateTime April(this int day, int year, int hour = 0, int minute = 0, int second = 0)
{
return new DateTime(year, 4, day, hour, minute, second);
@ -73,6 +89,10 @@
/// <param name="hour">The hour.</param>
/// <param name="minute">The minute.</param>
/// <param name="second">The second.</param>
[Obsolete(
"This method has been deprecated in favor of Humanizer's fluent DateTime API. " +
"Please consider downloading the Humanizer package for more stable implementations of this method."
)]
public static DateTime May(this int day, int year, int hour = 0, int minute = 0, int second = 0)
{
return new DateTime(year, 5, day, hour, minute, second);
@ -86,6 +106,10 @@
/// <param name="hour">The hour.</param>
/// <param name="minute">The minute.</param>
/// <param name="second">The second.</param>
[Obsolete(
"This method has been deprecated in favor of Humanizer's fluent DateTime API. " +
"Please consider downloading the Humanizer package for more stable implementations of this method."
)]
public static DateTime June(this int day, int year, int hour = 0, int minute = 0, int second = 0)
{
return new DateTime(year, 6, day, hour, minute, second);
@ -112,6 +136,10 @@
/// <param name="hour">The hour.</param>
/// <param name="minute">The minute.</param>
/// <param name="second">The second.</param>
[Obsolete(
"This method has been deprecated in favor of Humanizer's fluent DateTime API. " +
"Please consider downloading the Humanizer package for more stable implementations of this method."
)]
public static DateTime August(this int day, int year, int hour = 0, int minute = 0, int second = 0)
{
return new DateTime(year, 8, day, hour, minute, second);
@ -125,6 +153,10 @@
/// <param name="hour">The hour.</param>
/// <param name="minute">The minute.</param>
/// <param name="second">The second.</param>
[Obsolete(
"This method has been deprecated in favor of Humanizer's fluent DateTime API. " +
"Please consider downloading the Humanizer package for more stable implementations of this method."
)]
public static DateTime September(this int day, int year, int hour = 0, int minute = 0, int second = 0)
{
return new DateTime(year, 9, day, hour, minute, second);
@ -138,6 +170,10 @@
/// <param name="hour">The hour.</param>
/// <param name="minute">The minute.</param>
/// <param name="second">The second.</param>
[Obsolete(
"This method has been deprecated in favor of Humanizer's fluent DateTime API. " +
"Please consider downloading the Humanizer package for more stable implementations of this method."
)]
public static DateTime October(this int day, int year, int hour = 0, int minute = 0, int second = 0)
{
return new DateTime(year, 10, day, hour, minute, second);
@ -151,6 +187,10 @@
/// <param name="hour">The hour.</param>
/// <param name="minute">The minute.</param>
/// <param name="second">The second.</param>
[Obsolete(
"This method has been deprecated in favor of Humanizer's fluent DateTime API. " +
"Please consider downloading the Humanizer package for more stable implementations of this method."
)]
public static DateTime November(this int day, int year, int hour = 0, int minute = 0, int second = 0)
{
return new DateTime(year, 11, day, hour, minute, second);
@ -164,6 +204,10 @@
/// <param name="hour">The hour.</param>
/// <param name="minute">The minute.</param>
/// <param name="second">The second.</param>
[Obsolete(
"This method has been deprecated in favor of Humanizer's fluent DateTime API. " +
"Please consider downloading the Humanizer package for more stable implementations of this method."
)]
public static DateTime December(this int day, int year, int hour = 0, int minute = 0, int second = 0)
{
return new DateTime(year, 12, day, hour, minute, second);
@ -175,61 +219,109 @@
// TODO change
[Obsolete(
"This method has been deprecated in favor of Humanizer's fluent DateTime API. " +
"Please consider downloading the Humanizer package for more stable implementations of this method."
)]
public static TimeSpan Days(this uint number)
{
return TimeSpan.FromDays(number);
}
[Obsolete(
"This method has been deprecated in favor of Humanizer's fluent DateTime API. " +
"Please consider downloading the Humanizer package for more stable implementations of this method."
)]
public static TimeSpan Hours(this uint number)
{
return TimeSpan.FromHours(number);
}
[Obsolete(
"This method has been deprecated in favor of Humanizer's fluent DateTime API. " +
"Please consider downloading the Humanizer package for more stable implementations of this method."
)]
public static TimeSpan Milliseconds(this uint number)
{
return TimeSpan.FromSeconds(number);
}
[Obsolete(
"This method has been deprecated in favor of Humanizer's fluent DateTime API. " +
"Please consider downloading the Humanizer package for more stable implementations of this method."
)]
public static TimeSpan Minutes(this uint number)
{
return TimeSpan.FromMinutes(number);
}
[Obsolete(
"This method has been deprecated in favor of Humanizer's fluent DateTime API. " +
"Please consider downloading the Humanizer package for more stable implementations of this method."
)]
public static TimeSpan Seconds(this uint number)
{
return TimeSpan.FromSeconds(number);
}
[Obsolete(
"This method has been deprecated in favor of Humanizer's fluent DateTime API. " +
"Please consider downloading the Humanizer package for more stable implementations of this method."
)]
public static TimeSpan Ticks(this uint number)
{
return TimeSpan.FromTicks(number);
}
[Obsolete(
"This method has been deprecated in favor of Humanizer's fluent DateTime API. " +
"Please consider downloading the Humanizer package for more stable implementations of this method."
)]
public static TimeSpan Days(this int number)
{
return TimeSpan.FromDays(number);
}
[Obsolete(
"This method has been deprecated in favor of Humanizer's fluent DateTime API. " +
"Please consider downloading the Humanizer package for more stable implementations of this method."
)]
public static TimeSpan Hours(this int number)
{
return TimeSpan.FromHours(number);
}
[Obsolete(
"This method has been deprecated in favor of Humanizer's fluent DateTime API. " +
"Please consider downloading the Humanizer package for more stable implementations of this method."
)]
public static TimeSpan Milliseconds(this int number)
{
return TimeSpan.FromSeconds(number);
}
[Obsolete(
"This method has been deprecated in favor of Humanizer's fluent DateTime API. " +
"Please consider downloading the Humanizer package for more stable implementations of this method."
)]
public static TimeSpan Minutes(this int number)
{
return TimeSpan.FromMinutes(number);
}
[Obsolete(
"This method has been deprecated in favor of Humanizer's fluent DateTime API. " +
"Please consider downloading the Humanizer package for more stable implementations of this method."
)]
public static TimeSpan Seconds(this int number)
{
return TimeSpan.FromSeconds(number);
}
[Obsolete(
"This method has been deprecated in favor of Humanizer's fluent DateTime API. " +
"Please consider downloading the Humanizer package for more stable implementations of this method."
)]
public static TimeSpan Ticks(this int number)
{
return TimeSpan.FromTicks(number);

View File

@ -15,56 +15,100 @@
// TODO change
[Obsolete(
"This method has been deprecated in favor of Humanizer's fluent DateTime API. " +
"Please consider downloading the Humanizer package for more stable implementations of this method."
)]
public static TimeSpan Days(this ulong number)
{
return TimeSpan.FromDays(number);
}
[Obsolete(
"This method has been deprecated in favor of Humanizer's fluent DateTime API. " +
"Please consider downloading the Humanizer package for more stable implementations of this method."
)]
public static TimeSpan Hours(this ulong number)
{
return TimeSpan.FromHours(number);
}
[Obsolete(
"This method has been deprecated in favor of Humanizer's fluent DateTime API. " +
"Please consider downloading the Humanizer package for more stable implementations of this method."
)]
public static TimeSpan Milliseconds(this ulong number)
{
return TimeSpan.FromSeconds(number);
}
[Obsolete(
"This method has been deprecated in favor of Humanizer's fluent DateTime API. " +
"Please consider downloading the Humanizer package for more stable implementations of this method."
)]
public static TimeSpan Minutes(this ulong number)
{
return TimeSpan.FromMinutes(number);
}
[Obsolete(
"This method has been deprecated in favor of Humanizer's fluent DateTime API. " +
"Please consider downloading the Humanizer package for more stable implementations of this method."
)]
public static TimeSpan Seconds(this ulong number)
{
return TimeSpan.FromSeconds(number);
}
[Obsolete(
"This method has been deprecated in favor of Humanizer's fluent DateTime API. " +
"Please consider downloading the Humanizer package for more stable implementations of this method."
)]
public static TimeSpan Days(this long number)
{
return TimeSpan.FromDays(number);
}
[Obsolete(
"This method has been deprecated in favor of Humanizer's fluent DateTime API. " +
"Please consider downloading the Humanizer package for more stable implementations of this method."
)]
public static TimeSpan Hours(this long number)
{
return TimeSpan.FromHours(number);
}
[Obsolete(
"This method has been deprecated in favor of Humanizer's fluent DateTime API. " +
"Please consider downloading the Humanizer package for more stable implementations of this method."
)]
public static TimeSpan Milliseconds(this long number)
{
return TimeSpan.FromSeconds(number);
}
[Obsolete(
"This method has been deprecated in favor of Humanizer's fluent DateTime API. " +
"Please consider downloading the Humanizer package for more stable implementations of this method."
)]
public static TimeSpan Minutes(this long number)
{
return TimeSpan.FromMinutes(number);
}
[Obsolete(
"This method has been deprecated in favor of Humanizer's fluent DateTime API. " +
"Please consider downloading the Humanizer package for more stable implementations of this method."
)]
public static TimeSpan Seconds(this long number)
{
return TimeSpan.FromSeconds(number);
}
[Obsolete(
"This method has been deprecated in favor of Humanizer's fluent DateTime API. " +
"Please consider downloading the Humanizer package for more stable implementations of this method."
)]
public static TimeSpan Ticks(this long number)
{
return TimeSpan.FromTicks(number);

View File

@ -41,6 +41,10 @@
/// <typeparam name="T">The type of the Enum</typeparam>
/// <param name="value">String value to parse</param>
/// <returns>The Enum corresponding to the stringExtensions</returns>
[Obsolete(
"This method has been deprecated in favor of Humanizer.DehumanizeTo<TTargetEnum>(). "+
"Please consider downloading the Humanizer package for more stable implementations of this method."
)]
public static T EnumParse<T>(this string value)
{
return value.EnumParse<T>(false);
@ -53,6 +57,10 @@
/// <param name="value">String value to parse</param>
/// <param name="ignoreCase">Whether or not to ignore casing.</param>
/// <returns>The Enum corresponding to the stringExtensions</returns>
[Obsolete(
"This method has been deprecated in favor of Humanizer.DehumanizeTo<TTargetEnum>(). " +
"Please consider downloading the Humanizer package for more stable implementations of this method."
)]
public static T EnumParse<T>(this string value, bool ignoreCase)
{
if (value == null)