diff --git a/LightweightIocContainer/IocContainer.cs b/LightweightIocContainer/IocContainer.cs
index 9766856..7ecba5c 100644
--- a/LightweightIocContainer/IocContainer.cs
+++ b/LightweightIocContainer/IocContainer.cs
@@ -80,8 +80,8 @@ namespace LightweightIocContainer
/// Could not find function
public object Resolve(Type type, object[] arguments) //somehow the order of the arguments is different in the application compared to the unit test
{
- var resolveMethod = typeof(IocContainer).GetMethod(nameof(ResolveInternal), BindingFlags.NonPublic | BindingFlags.Instance);
- var genericResolveMethod = resolveMethod?.MakeGenericMethod(type);
+ MethodInfo resolveMethod = typeof(IocContainer).GetMethod(nameof(ResolveInternal), BindingFlags.NonPublic | BindingFlags.Instance);
+ MethodInfo genericResolveMethod = resolveMethod?.MakeGenericMethod(type);
if (genericResolveMethod == null)
throw new InternalResolveException($"Could not find function {nameof(ResolveInternal)}");
@@ -106,11 +106,11 @@ namespace LightweightIocContainer
if (registration is IDefaultRegistration defaultRegistration)
{
if (defaultRegistration.Lifestyle == Lifestyle.Singleton)
- return GetOrCreateSingletonInstance(defaultRegistration, arguments);
+ return GetOrCreateSingletonInstance(defaultRegistration, arguments);
else if (defaultRegistration is IMultitonRegistration multitonRegistration && defaultRegistration.Lifestyle == Lifestyle.Multiton)
- return GetOrCreateMultitonInstance(multitonRegistration, arguments);
+ return GetOrCreateMultitonInstance(multitonRegistration, arguments);
- return CreateInstance(defaultRegistration, arguments);
+ return CreateInstance(defaultRegistration, arguments);
}
else if (registration is ITypedFactoryRegistration typedFactoryRegistration)
{
@@ -135,7 +135,7 @@ namespace LightweightIocContainer
return (T) instance;
//if it doesn't already exist create a new instance and add it to the list
- T newInstance = CreateInstance(registration, arguments);
+ T newInstance = CreateInstance(registration, arguments);
_singletons.Add((typeof(T), newInstance));
return newInstance;
@@ -167,14 +167,14 @@ namespace LightweightIocContainer
if (instance != (null, null))
return (T) instance.instance;
- T createdInstance = CreateInstance(registration, arguments);
+ T createdInstance = CreateInstance(registration, arguments);
instances.Add((scopeArgument, createdInstance));
return createdInstance;
}
- T newInstance = CreateInstance(registration, arguments);
- _multitons.Add((typeof(T), registration.Scope, new List<(object, object)>() {(scopeArgument, newInstance)}));
+ T newInstance = CreateInstance(registration, arguments);
+ _multitons.Add((typeof(T), registration.Scope, new List<(object, object)> {(scopeArgument, newInstance)}));
return newInstance;
}
@@ -204,7 +204,7 @@ namespace LightweightIocContainer
private object[] ResolveConstructorArguments(Type type, object[] arguments)
{
//find best ctor
- var sortedCtors = type.GetConstructors().OrderByDescending(c => c.GetParameters().Length);
+ IOrderedEnumerable sortedCtors = type.GetConstructors().OrderByDescending(c => c.GetParameters().Length);
foreach (var ctor in sortedCtors)
{
try
@@ -212,7 +212,7 @@ namespace LightweightIocContainer
List