var builder = new ContainerBuilder(); builder.RegisterType().As (); var container = builder.Build(); var logger = container.Resolve ();
var builder = new ContainerBuilder(); builder.RegisterTypeIn this example, we use the RegisterType method to register the Calculator class as a service. The Calculator class takes two parameters in its constructor – ILogger and IParser. However, we haven't explicitly registered these types with the container. We can register them separately or let the container automatically resolve them. Package Library: Autofac.Core.().As (); var container = builder.Build(); var calculator = container.Resolve ();