Say I have a class and I want to deprecate a method. Is it possible to have that method not show up in intellisense so that people won't be temped to use it? I just want existing code that uses it to continue compiling but hide the method from view at the same time.
IntelliSense is a code-completion aid that includes a number of features: List Members, Parameter Info, Quick Info, and Complete Word. These features help you to learn more about the code you're using, keep track of the parameters you're typing, and add calls to properties and methods with only a few keystrokes.
The default key binding for this is Ctrl + Shift + Space .
IntelliSense is a general term for various code editing features including: code completion, parameter info, quick info, and member lists. IntelliSense features are sometimes called by other names such as "code completion", "content assist", and "code hinting."
The EditorBrowsableAttribute attribute can be used to hide members from intellisense:
http://msdn.microsoft.com/en-us/library/system.componentmodel.editorbrowsableattribute.aspx
Alternatively, you can use the System.ObsoleteAttribute. It still might be a good idea to have the method show up in intellisense, since technically it exists.
Using this attribute will show the method name in the intellisense, but with a [deprecated]
tag in front of it.
[Obsolete("Method is in the process of deprecation.")]
void MyMethod() {...}
If you use ReSharper, and tell it to override Visual Studio's Intellisense settings, it will strikethrough the method name.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With