Skip to content

Commit d89dd23

Browse files
committed
refactor(type-helper): remove reflection dep and simplify null check
1 parent aeb41af commit d89dd23

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/JsonApiDotNetCore/Internal/TypeHelper.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using System;
2-
using System.Reflection;
32

43
namespace JsonApiDotNetCore.Internal
54
{
@@ -10,8 +9,7 @@ public static object ConvertType(object value, Type type)
109
if(value == null)
1110
return null;
1211

13-
if (type.GetTypeInfo().IsGenericType && type.GetGenericTypeDefinition().Equals(typeof(Nullable<>)))
14-
type = Nullable.GetUnderlyingType(type);
12+
type = Nullable.GetUnderlyingType(type) ?? type;
1513

1614
var stringValue = value.ToString();
1715

0 commit comments

Comments
 (0)