/// <summary> /// Creates a new extension object and adds it to the container. /// </summary> /// <typeparam name="TExtension">Type of <see cref="IServiceContainerExtension"/> to add.</typeparam> /// <param name="container">Container to add the extension to.</param> /// <returns>The <see cref="IServiceContainer"/> object that this method was called on (this in C#, Me in Visual Basic).</returns> public static IServiceContainer AddNewExtension <TExtension>(this IServiceContainer container) where TExtension : IServiceContainerExtension, new() { if (container == null) { throw new ArgumentNullException(nameof(container)); } return(container.AddExtension(new TExtension())); }
/// <summary> /// Add an extension object to the container. /// </summary> /// <param name="extension"><see cref="IServiceContainerExtension"/> to add.</param> /// <returns>The <see cref="IServiceContainer"/> object that this method was called on.</returns> public IServiceContainer AddExtension(IServiceContainerExtension extension) { _container.AddExtension(extension); return(this); }