Skip to content

Commit

Permalink
Merge pull request #859 from EdwardCooke/ec-858-static-typeresolver-e…
Browse files Browse the repository at this point in the history
…nums

Special case on statictyperesolver for enums

+semver:fix
  • Loading branch information
EdwardCooke committed Oct 15, 2023
2 parents f45d1f7 + dd3c3b6 commit 8472305
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 8472305

Please sign in to comment.