Skip to content

Commit

Permalink
Merge pull request #22 from Dini001/patch-2
Browse files Browse the repository at this point in the history
Adding deserialization support for Enums
  • Loading branch information
morrisjdev authored Mar 18, 2020
2 parents 87f6724 + 1be677a commit 4837da9
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions FileContextCore/Serializer/SerializerHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ public static object Deserialize(this string input, Type type)
return arr.ToArray();
}

if (type.IsEnum)
{
return Enum.Parse(type, input);
}

return Convert.ChangeType(input, type, CultureInfo.InvariantCulture);
}
Expand Down

0 comments on commit 4837da9

Please sign in to comment.