From 10a56424f07a6afa1ba7c18819b0f7ed88672d26 Mon Sep 17 00:00:00 2001 From: Simon Gockner Date: Thu, 4 Jul 2019 13:26:32 +0200 Subject: [PATCH] fix #16: add check if argument is type of the parameter type --- LightweightIocContainer/IocContainer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LightweightIocContainer/IocContainer.cs b/LightweightIocContainer/IocContainer.cs index 590346b..6cc0777 100644 --- a/LightweightIocContainer/IocContainer.cs +++ b/LightweightIocContainer/IocContainer.cs @@ -221,7 +221,7 @@ namespace LightweightIocContainer object fittingArgument = new InternalResolvePlaceholder(); if (argumentsList != null) { - fittingArgument = argumentsList.FirstOrGiven(a => a?.GetType() == parameter.ParameterType); + fittingArgument = argumentsList.FirstOrGiven(a => a?.GetType() == parameter.ParameterType || parameter.ParameterType.IsInstanceOfType(a)); if (!(fittingArgument is InternalResolvePlaceholder)) { int index = argumentsList.IndexOf(fittingArgument);