gpt4 book ai didi

c# - Autofac 与 F#

转载 作者:太空狗 更新时间:2023-10-29 23:09:48 24 4
gpt4 key购买 nike

我将如何转换现有的 C# 代码

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

进入 F#?

最佳答案

open Autofac
let _containerBuilder = new ContainerBuilder()

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

_containerBuilder.RegisterGeneric(typedefof<PropertyProvider<_>>)
.As(typedefof<IPropertyProvider<_>>);

关于c# - Autofac 与 F#,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9899364/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com