Abe*_*ler 17 .net intellisense visual-studio
假设我有一个类,我想弃用一个方法.是否有可能让这种方法不会出现在intellisense中,这样人们就不会习惯使用它?我只想要使用它的现有代码继续编译,但同时从视图中隐藏方法.
Tim*_*oyd 12
EditorBrowsableAttribute属性可用于隐藏intellisense中的成员:
http://msdn.microsoft.com/en-us/library/system.componentmodel.editorbrowsableattribute.aspx
或者,您可以使用System.ObsoleteAttribute.将方法显示在intellisense中仍然是一个好主意,因为从技术上讲它是存在的.
使用此属性将在intellisense中显示方法名称,但[deprecated]前面带有标记.
[Obsolete("Method is in the process of deprecation.")]
void MyMethod() {...}
Run Code Online (Sandbox Code Playgroud)
如果您使用ReSharper,并告诉它覆盖Visual Studio的Intellisense设置,它将删除方法名称.
| 归档时间: |
|
| 查看次数: |
1011 次 |
| 最近记录: |