1
0
mirror of https://github.com/oliverbooth/X10D synced 2024-11-10 03:45:41 +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> /// <summary>
/// Parses a <see cref="String"/> into an <see cref="Enum"/>. /// Parses a <see cref="String"/> into an <see cref="Enum"/>.
/// </summary> /// </summary>
/// <typeparam name="T">The type of the Enum</typeparam> /// <typeparam name="T">The type of the <see cref="Enum"/>.</typeparam>
/// <param name="value">String value to parse</param> /// <param name="value">The <see cref="String"/> value to parse</param>
/// <returns>The Enum corresponding to the stringExtensions</returns> /// <returns>The <see cref="Enum"/> value corresponding to the <see cref="String"/>.</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) public static T EnumParse<T>(this string value)
{ {
return value.EnumParse<T>(false); return value.EnumParse<T>(false);
@ -54,14 +50,10 @@
/// <summary> /// <summary>
/// Parses a <see cref="String"/> into an <see cref="Enum"/>. /// Parses a <see cref="String"/> into an <see cref="Enum"/>.
/// </summary> /// </summary>
/// <typeparam name="T">The type of the Enum</typeparam> /// <typeparam name="T">The type of the <see cref="Enum"/>.</typeparam>
/// <param name="value">String value to parse</param> /// <param name="value">The <see cref="String"/> value to parse</param>
/// <param name="ignoreCase">Whether or not to ignore casing.</param> /// <param name="ignoreCase">Whether or not to ignore casing.</param>
/// <returns>The Enum corresponding to the stringExtensions</returns> /// <returns>The <see cref="Enum"/> value corresponding to the <see cref="String"/></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) public static T EnumParse<T>(this string value, bool ignoreCase)
{ {
if (value == null) if (value == null)