Skip to content

Commit b9e6a18

Browse files
committed
Remove System.Linq.Expressions dependency.
1 parent 9a54d78 commit b9e6a18

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

src/CommandLine/Core/ReflectionExtensions.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
using System.Collections;
55
using System.Collections.Generic;
66
using System.Linq;
7-
using System.Linq.Expressions;
87
using System.Reflection;
98
using CommandLine.Infrastructure;
109
using CommandLine.Text;
@@ -121,11 +120,7 @@ public static object CreateEmptyArray(this Type type)
121120

122121
public static object GetDefaultValue(this Type type)
123122
{
124-
var e = Expression.Lambda<Func<object>>(
125-
Expression.Convert(
126-
Expression.Default(type),
127-
typeof(object)));
128-
return e.Compile()();
123+
return type.IsReferenceType ? null : Activator.CreateInstance(type);
129124
}
130125

131126
public static bool IsMutable(this Type type)

0 commit comments

Comments
 (0)