Ste*_*sen 7 c# f# visual-studio-2010 visual-studio
作为这个问题的后续,我想知道是否有可能将模块中的F#函数(可能是通过属性)标记为Intellisense中的"隐藏".回顾一下,我有一些标记的函数,inline
但是根据我不想公开的其他函数实现.因此,虽然实现函数必须保持公开(因为它们被内联),但我记得在过去我遇到过隐藏在Visual Studio Intellisense中的C#方法,但如果你知道它们是什么就编译得很好,但是我不记得确切的方法,我不确定这是某种特殊的Visual Studio事物还是一种可用的功能,如DebuggerBrowsable(DebuggerBrowsableState.Never)
意识.
更新:我尝试应用EditorBrowsable(EditorBrowsableState.Never)
但它似乎不适用于Visual F#项目.
我最近尝试这样做,我很确定F#会忽略该EditorBrowsable
属性.
使声明从IntelliSense中消失的唯一方法是使用ObsoleteAttribute
,但这也意味着当您实际使用该函数时,您将收到警告.这有点不幸,但是如果您只使用某些实现文件中的函数可能会没用,您可以在其中禁用警告:
声明在一个文件中:
module Internal =
[<System.ObsoleteAttribute>]
let foo = 10
Run Code Online (Sandbox Code Playgroud)
禁用警告和使用的实现文件foo
:
// Disable 'obsolete' warning
#nowarn "44"
// 'Internal' is empty (and is not shown in the completion list)
Internal.foo
Run Code Online (Sandbox Code Playgroud)
该属性可以应用于模块,函数和类型,因此非常灵活.
归档时间: |
|
查看次数: |
512 次 |
最近记录: |