Question

How would I convert the existing C# code

_containerBuilder = new ContainerBuilder();
_containerBuilder.RegisterGeneric(typeof(CommandObserver<>)).As(typeof(ICommandObserver<>));
_containerBuilder.RegisterGeneric(typeof(PropertyProvider<>)).As(typeof(IPropertyProvider<>)); 

into F#?

Était-ce utile?

La solution

open Autofac
let _containerBuilder = new ContainerBuilder()

_containerBuilder.RegisterGeneric(typedefof<CommandObserver<_>>)
    .As(typedefof<ICommandObserver<_>>);

_containerBuilder.RegisterGeneric(typedefof<PropertyProvider<_>>)
    .As(typedefof<IPropertyProvider<_>>);
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top