.net - 什么是 RequireQualifiedAccess 属性?

标签 .net f#

来自docs :

This attribute is used to indicate that references to the elements of a module, record or union type require explicit qualified access.

什么是显式限定访问?什么是隐式访问?

最佳答案

也许一个具体的例子会有所帮助。

List 模块具有此属性。这意味着您不被允许打开该模块:

open List // compile error!

map id [1;2]

相反,您必须这样做:

List.map id [1;2]

关于.net - 什么是 RequireQualifiedAccess 属性?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44462268/

相关文章:

c# - C#/CLI 标识符的最大长度是多少?

c# - Windows 窗体 StatusStrip 控件中的纯图像

.net - 如何让 NHibernate 将 String.Empty 属性值保留为 NULL

list - 与 List 相比,F# 序列操作主要慢吗?

C# HttpClient.PostAsync 并等待崩溃的应用程序

C# 令人困惑的性能测试结果

.net - 为什么我应该用自定义平等属性标记我的类型?

f# - 在 F# 中,是否可以将对可变默认值的引用作为参数传递?

F# 隐藏突变

F# - 在 curried 函数参数上设置类型注释