Skip to content

Commit

Permalink
Merge pull request #764 from NN---/remove_expression
Browse files Browse the repository at this point in the history
Remove System.Linq.Expressions dependency.
  • Loading branch information
ericnewton76 authored May 12, 2022
2 parents 40a4104 + 31895f1 commit af75319
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions src/CommandLine/Core/ReflectionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using CommandLine.Infrastructure;
using CommandLine.Text;
Expand Down Expand Up @@ -121,11 +120,7 @@ public static object CreateEmptyArray(this Type type)

public static object GetDefaultValue(this Type type)
{
var e = Expression.Lambda<Func<object>>(
Expression.Convert(
Expression.Default(type),
typeof(object)));
return e.Compile()();
return type.IsValueType ? Activator.CreateInstance(type) : null;
}

public static bool IsMutable(this Type type)
Expand Down

0 comments on commit af75319

Please sign in to comment.