如何防止提供扩展方法的公共类出现在Intellisense中? [英] How can I prevent a public class that provides extension methods from appearing in Intellisense?

查看:72
本文介绍了如何防止提供扩展方法的公共类出现在Intellisense中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么办法可以从Intellisense中隐藏"一个类的名称,该类的唯一目的是提供扩展方法?

Is there any way to 'hide' the name of a class, whose sole purpose is to provide extension methods, from Intellisense?

我想从Intellisense列表中删除类名称,但需要通过常规方式通过Intellisense将类的扩展方法提供给外部程序集.

I would like to remove the class name from the Intellisense list but need the extension methods of the class to be available to external assemblies via Intellisense in the usual way.

推荐答案

好的,我对此有答案.哈格里姆建议给班级打上标记.

Ok, I have the answer to this. Hallgrim's suggestion of marking the class with..

[EditorBrowsable(EditorBrowsableState.Never)]

..确实有效,但仅在引用 assembly 的地方有效,而不是项目,就像我自己的VS解决方案在编写提供该类的程序集时那样.扩展方法可以照常使用.

..does actually work but only where the assembly is being referenced, rather than the project, as would be the case in my own VS solution whilst writing the assembly that provides the class. The extension methods are available as usual.

这篇关于如何防止提供扩展方法的公共类出现在Intellisense中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆