Catel.IoC.CatelDependencyResolver.ResolveAll C# (CSharp) Method

ResolveAll() public method

Resolves the specified types with the specified tag.
public ResolveAll ( Type types, object tag = null ) : object[]
types System.Type The types.
tag object The tag.
return object[]
        public object[] ResolveAll(Type[] types, object tag = null)
        {
            Argument.IsNotNull("types", types);

            if (types.Length == 0)
            {
                return new object[] { };
            }

            int typeCount = types.Length;
            var resolvedTypes = new object[typeCount];

            lock (_serviceLocator)
            {
                for (int i = 0; i < typeCount; i++)
                {
                    try
                    {
                        resolvedTypes[i] = Resolve(types[i], tag);
                    }
                    catch (TypeNotRegisteredException ex)
                    {
                        Log.Debug(ex, "Failed to resolve type '{0}', returning null", ex.RequestedType.GetSafeFullName(false));
                    }
                }
            }

            return resolvedTypes;
        }
    }