Skip to content

Commit af75319

Browse files
authored
Merge pull request #764 from NN---/remove_expression
Remove System.Linq.Expressions dependency.
2 parents 40a4104 + 31895f1 commit af75319

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

src/CommandLine/Core/ReflectionExtensions.cs

+1-6
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.IsValueType ? Activator.CreateInstance(type) : null;
129124
}
130125

131126
public static bool IsMutable(this Type type)

0 commit comments

Comments
 (0)