gpt4 book ai didi

enums - F# 枚举 : expected to have type xxx but here has type xxx

转载 作者:行者123 更新时间:2023-12-01 01:56:04 25 4
gpt4 key购买 nike

我正在尝试使用 LightningDB.net。其中一种方法接受参数作为枚举标志。

C#中的方法声明:

Open(EnvironmentOpenFlags openFlags = EnvironmentOpenFlags.None, UnixAccessMode accessMode = UnixAccessMode.Default)

当我为 openFlags 提供论据时如: env.Open(EnvironmentOpenFlags.NoSync)我收到编译器错误:
error FS0001: This expression was expected to have type    LightningDB.EnvironmentOpenFlags    but here has type    LightningDB.EnvironmentOpenFlags

When I provide argument for 2nd argument of the method, it works:

env.Open(accessMode = UnixAccessMode.Default)

任何组合,包括尝试将 enum 转换为 int 然后返回总是会导致编译器错误。

这是在 VS 2015 上。知道是什么原因造成的以及如何解决吗?

最佳答案

该程序集在项目中一次,一次直接引用,第二次嵌入另一个程序集中,从而导致错误。

关于enums - F# 枚举 : expected to have type xxx but here has type xxx,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40413349/

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