Skip to content

Commit

Permalink
remove null check
Browse files Browse the repository at this point in the history
  • Loading branch information
elachlan committed Dec 17, 2022
1 parent fc381a2 commit f6e5d1c
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -278,10 +278,10 @@ protected virtual object CreateInstance(Type type, ICollection? arguments, strin

object?[] tempArgs = new object?[argArray.Length];
// Walk the public constructors looking for one to invoke here with the arguments we have.
foreach (ConstructorInfo ci in TypeDescriptor.GetReflectionType(type).GetConstructors(BindingFlags.Instance | BindingFlags.Public | BindingFlags.CreateInstance))
foreach (ConstructorInfo info in TypeDescriptor.GetReflectionType(type).GetConstructors(BindingFlags.Instance | BindingFlags.Public | BindingFlags.CreateInstance))
{
ParameterInfo[] parameters = ci.GetParameters();
if (parameters is not null && parameters.Length == types.Length)
ParameterInfo[] parameters = info.GetParameters();
if (parameters.Length == types.Length)
{
bool match = true;
// Walk every type of argument we have and see if it matches up exactly or is a derived type of corresponding constructor argument.
Expand Down

0 comments on commit f6e5d1c

Please sign in to comment.