🎖 Credit original author of string.EnumParse

This commit is contained in:
Oliver Booth 2020-04-20 14:13:57 +01:00
parent 5c447f1b02
commit 72f9474e1c
No known key found for this signature in database
GPG Key ID: 0D7F2EF1C8D2B9C0
1 changed files with 4 additions and 0 deletions

View File

@ -71,6 +71,8 @@
/// <typeparam name="T">The type of the <see cref="Enum"/>.</typeparam> /// <typeparam name="T">The type of the <see cref="Enum"/>.</typeparam>
/// <param name="value">The <see cref="string"/> value to parse.</param> /// <param name="value">The <see cref="string"/> value to parse.</param>
/// <returns>The <see cref="Enum"/> value corresponding to the <see cref="string"/>.</returns> /// <returns>The <see cref="Enum"/> value corresponding to the <see cref="string"/>.</returns>
/// <remarks>Credit for this method goes to Scott Dorman:
/// (http://geekswithblogs.net/sdorman/Default.aspx)</remarks>
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);
@ -83,6 +85,8 @@
/// <param name="value">The <see cref="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 <see cref="Enum"/> value corresponding to the <see cref="string"/>.</returns> /// <returns>The <see cref="Enum"/> value corresponding to the <see cref="string"/>.</returns>
/// <remarks>Credit for this method goes to Scott Dorman:
/// (http://geekswithblogs.net/sdorman/Default.aspx)</remarks>
public static T EnumParse<T>(this string value, bool ignoreCase) public static T EnumParse<T>(this string value, bool ignoreCase)
{ {
if (value is null) if (value is null)