private ServiceLifetime?GetServiceLifeTime <T>() { var serviceDescriptor = new ServiceDescriptor[_serviceCollection.Count]; _serviceCollection.CopyTo(serviceDescriptor, 0); return(serviceDescriptor.FirstOrDefault(u => u.ServiceType == typeof(T))?.Lifetime); }