Skip to content

Commit a9243e9

Browse files
authored
Merge pull request #376 from johndkane/remove-duplicate-code
Remove duplication by delegating calls to CreateDefaultImmutableInsta…
2 parents d0bf530 + 2da8209 commit a9243e9

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

Diff for: src/CommandLine/Infrastructure/ReflectionHelper.cs

+2-5
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,8 @@ public static bool IsFSharpOptionType(Type type)
7979

8080
public static T CreateDefaultImmutableInstance<T>(Type[] constructorTypes)
8181
{
82-
var t = typeof(T);
83-
var ctor = t.GetTypeInfo().GetConstructor(constructorTypes);
84-
var values = (from prms in ctor.GetParameters()
85-
select prms.ParameterType.CreateDefaultForImmutable()).ToArray();
86-
return (T)ctor.Invoke(values);
82+
var t = typeof(T);
83+
return (T)CreateDefaultImmutableInstance(t, constructorTypes);
8784
}
8885

8986
public static object CreateDefaultImmutableInstance(Type type, Type[] constructorTypes)

0 commit comments

Comments
 (0)