fix: 更新 Converter 使枚举转变成 Int

This commit is contained in:
Argo-Tianyi 2022-01-18 20:02:00 +08:00
parent f12b2d254a
commit 6657c29c79
1 changed files with 2 additions and 2 deletions

View File

@ -48,9 +48,9 @@ class StringToEnumConverter
{ {
object? ret; object? ret;
var field = value?.ToString(); var field = value?.ToString();
if (!string.IsNullOrEmpty(field) && Enum.IsDefined(TargetType, field)) if (!string.IsNullOrEmpty(field) && Enum.TryParse(TargetType, field, out var v))
{ {
ret = field; ret = v;
} }
else else
{ {