public ScopedServiceProvider(IReadOnlyServiceCollection serviceCollection)
        {
            if (serviceCollection == null)
            {
                throw new ArgumentNullException(nameof(serviceCollection));
            }

            this.serviceCollection = serviceCollection;
            this.instances         = new TypedCache <object>(capacity: 64);
        }
        public void Dispose()
        {
            if (instances == null)
            {
                return;
            }

            foreach (object instance in instances.GetItems())
            {
                if (instance is IDisposable disposable)
                {
                    disposable.Dispose();
                }
            }
            instances.Clear();
            instances = null;
        }