Skip to content

Commit

Permalink
Special case on statictyperesolver for enums
Browse files Browse the repository at this point in the history
  • Loading branch information
EdwardCooke committed Oct 15, 2023
1 parent f45d1f7 commit dd3c3b6
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions YamlDotNet/Serialization/TypeResolvers/StaticTypeResolver.cs
Expand Up @@ -32,6 +32,11 @@ public virtual Type Resolve(Type staticType, object? actualValue)
{
if (actualValue != null)
{
if (actualValue.GetType().IsEnum)
{
return staticType;
}

switch (actualValue.GetType().GetTypeCode())
{
case TypeCode.Boolean: return typeof(bool);
Expand Down

0 comments on commit dd3c3b6

Please sign in to comment.