From c6d473b7e68abfd5dd409bbb5b9b005abaf767ea Mon Sep 17 00:00:00 2001 From: Simon G Date: Tue, 7 Dec 2021 09:15:39 +0100 Subject: [PATCH] - refactor --- LightweightIocContainer/IocContainer.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/LightweightIocContainer/IocContainer.cs b/LightweightIocContainer/IocContainer.cs index 6bcc437..959a910 100644 --- a/LightweightIocContainer/IocContainer.cs +++ b/LightweightIocContainer/IocContainer.cs @@ -224,7 +224,7 @@ namespace LightweightIocContainer throw new MultipleRegistrationException(registration.InterfaceType); //don't allow lifestyle.multiton without iMultitonRegistration - if (registration is ILifestyleProvider lifestyleProvider && lifestyleProvider.Lifestyle == Lifestyle.Multiton && !(registration is IMultitonRegistration)) + if (registration is ILifestyleProvider { Lifestyle: Lifestyle.Multiton } and not IMultitonRegistration) throw new InvalidRegistrationException("Can't register a type as Lifestyle.Multiton without a scope (Registration is not of type IMultitonRegistration)."); Registrations.Add(registration); @@ -451,7 +451,7 @@ namespace LightweightIocContainer } } - object firstArgument = arguments.FirstOrGiven(a => !(a is InternalResolvePlaceholder)); //find the first argument that is not a placeholder + object firstArgument = arguments.FirstOrGiven(a => a is not InternalResolvePlaceholder); //find the first argument that is not a placeholder if (firstArgument is InternalResolvePlaceholder) //no more arguments available break; //there won't be any more arguments