var builder = new ContainerBuilder(); builder.RegisterType().As (); var container = builder.Build();
var builder = new ContainerBuilder(); builder.RegisterTypeThis code creates a new container builder, adds MyDependency to the container, builds the container, and then resolves an instance of MyDependency from the container. In both examples, we can see that ContainerBuilder is part of the Autofac package library, which is necessary to install in order to use this feature.().As (); var container = builder.Build(); var myDependency = container.Resolve ();