سؤال

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#?

هل كانت مفيدة؟

المحلول

open Autofac
let _containerBuilder = new ContainerBuilder()

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

_containerBuilder.RegisterGeneric(typedefof<PropertyProvider<_>>)
    .As(typedefof<IPropertyProvider<_>>);
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top