1
0
mirror of https://github.com/oliverbooth/X10D synced 2024-11-22 19:28:48 +00:00

🔨 Un-deprecate StringExtensions.EnumParse

Humanizer package doesn't necessarily return correct results
This commit is contained in:
Oliver Booth 2019-12-25 13:54:54 +00:00
parent 5e0cff8b81
commit 1e1aa0738a
No known key found for this signature in database
GPG Key ID: 0D7F2EF1C8D2B9C0

View File

@ -39,13 +39,9 @@
/// <summary>
/// Parses a <see cref="String"/> into an <see cref="Enum"/>.
/// </summary>
/// <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."
)]
/// <typeparam name="T">The type of the <see cref="Enum"/>.</typeparam>
/// <param name="value">The <see cref="String"/> value to parse</param>
/// <returns>The <see cref="Enum"/> value corresponding to the <see cref="String"/>.</returns>
public static T EnumParse<T>(this string value)
{
return value.EnumParse<T>(false);
@ -54,14 +50,10 @@
/// <summary>
/// Parses a <see cref="String"/> into an <see cref="Enum"/>.
/// </summary>
/// <typeparam name="T">The type of the Enum</typeparam>
/// <param name="value">String value to parse</param>
/// <typeparam name="T">The type of the <see cref="Enum"/>.</typeparam>
/// <param name="value">The <see cref="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."
)]
/// <returns>The <see cref="Enum"/> value corresponding to the <see cref="String"/></returns>
public static T EnumParse<T>(this string value, bool ignoreCase)
{
if (value == null)