Skip to content

Commit

Permalink
ToEnumByDescription调整
Browse files Browse the repository at this point in the history
  • Loading branch information
Coldairarrow committed Dec 9, 2023
1 parent 9879d91 commit b652f33
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions src/Colder.Common/Helpers/EnumHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,8 @@ public static T ToEnumByDescription<T>(this string enumDescription)
return (T)field.GetRawConstantValue();
}
}

if (field.Name == enumDescription)
{
return (T)field.GetRawConstantValue();
}
}

return default;
throw new Exception($"{enumDescription} 转换为{typeof(T).FullName} 失败");
}
}

0 comments on commit b652f33

Please sign in to comment.