mirror of
https://github.com/azaion/annotations.git
synced 2026-04-23 00:16:30 +00:00
fix detection label
fix schema migrator for enums
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
namespace Azaion.Common.Extensions;
|
||||
|
||||
public static class EnumExtensions
|
||||
{
|
||||
public static T GetValueOrDefault<T>(this string value, T defaultValue) where T : struct
|
||||
{
|
||||
if (string.IsNullOrEmpty(value))
|
||||
return defaultValue;
|
||||
|
||||
return Enum.TryParse(value, true, out T result) ? result : defaultValue;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user