I have a bunch of constants declared, and given a value but they are never used. Is there a way that CodeRush can delete all of these? I am having no luck with all of the options in the code cleanup for VB.NET. Thanks.
Here is an example of my code[VB.NET]
Const procName As String = "my name"
Visual Studio even notices these and flags them as a Warning since they are unused local constant.s
To accomplish your task I suggest you take advantage of the Remove unused members Code Cleanup rule which detects private members with no references and applies the Remove unused member refactoring to them:
Note please, that this rule matches not only constants, but also fields, properties, methods, etc.
Enable it on the CodeRush | Options | Editor | Visual Basic | Code Cleanup option page, then apply Code Cleanup for any document which contains unused private members using the Ctrl+. shortcut.
I have recorded this video to illustrate the process.
Additionally, Code Cleanup can be applied at a project or a solution level using the context menu in Visual Studio Solution Explorer tool window.
Please keep in mind the changes of solution or project level cleanup will reflect in Visual Studio`s Undo only when a document is open.
Please let me know whether or not this addresses your issue.