We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 40a4104 + 31895f1 commit af75319Copy full SHA for af75319
src/CommandLine/Core/ReflectionExtensions.cs
@@ -4,7 +4,6 @@
4
using System.Collections;
5
using System.Collections.Generic;
6
using System.Linq;
7
-using System.Linq.Expressions;
8
using System.Reflection;
9
using CommandLine.Infrastructure;
10
using CommandLine.Text;
@@ -121,11 +120,7 @@ public static object CreateEmptyArray(this Type type)
121
120
122
public static object GetDefaultValue(this Type type)
123
{
124
- var e = Expression.Lambda<Func<object>>(
125
- Expression.Convert(
126
- Expression.Default(type),
127
- typeof(object)));
128
- return e.Compile()();
+ return type.IsValueType ? Activator.CreateInstance(type) : null;
129
}
130
131
public static bool IsMutable(this Type type)
0 commit comments