mirror of
https://gitee.com/langsisi_admin/serein-flow
synced 2026-03-20 00:06:45 +08:00
增强了实例工程的抽象逻辑
This commit is contained in:
@@ -8,6 +8,16 @@ namespace Serein.Library.Utils
|
||||
{
|
||||
public static class EnumHelper
|
||||
{
|
||||
public static bool TryConvertEnum<T>(this string value, out T result) where T : struct, Enum
|
||||
{
|
||||
if (!string.IsNullOrEmpty(value) && Enum.TryParse(value, true, out T tempResult) && Enum.IsDefined(typeof(T), tempResult))
|
||||
{
|
||||
result = tempResult;
|
||||
return true;
|
||||
}
|
||||
result = default;
|
||||
return false;
|
||||
}
|
||||
public static TResult GetBoundValue<TEnum, TResult>(TEnum enumValue, Func<BindValueAttribute, object> valueSelector)
|
||||
where TEnum : Enum
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user