Skip to content

Commit b685001

Browse files
authored
Deserialize nullable with null value
When the type being deserialized has an string value it return de default value of the underlying type instead of null
1 parent 87f6724 commit b685001

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

FileContextCore/Serializer/SerializerHelper.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ static class SerializerHelper
1313
{
1414
public static object Deserialize(this string input, Type type)
1515
{
16-
type = Nullable.GetUnderlyingType(type) ?? type;
17-
1816
if (string.IsNullOrEmpty(input))
1917
{
2018
return type.GetDefaultValue();
2119
}
2220

21+
type = Nullable.GetUnderlyingType(type) ?? type;
22+
2323
if (type == typeof(DateTimeOffset))
2424
{
2525
return DateTimeOffset.Parse(input, CultureInfo.InvariantCulture);

0 commit comments

Comments
 (0)