如何删除 Visual Studio 中未使用的对象?
只是想知道,是否有一种更简单的方法可以从项目中完全删除控制对象?
假设我在表单上放置一个按钮并编写一些代码以使该按钮执行某些操作。几天后,我决定不再需要这个按钮。我只需在表单设计器上单击“删除”,但它会将变量名称和 onclick 函数保留在 .h 和 .cpp 文件(使用 C++ 编程时)或 onclick 方法(在 C# 中)中。然后我必须去找到按钮的所有痕迹并手动删除代码。我想知道是否有一个像“一键”创建方法一样删除按钮的“一键”解决方案(嗯,它不完全是一键生成变量和方法,但它不必访问更多也不是在一个不同的地方让它发挥作用)。
Just wondering, is there an easier way to remove control objects completely from a project?
Let's say I put a button on a form and write some code to make the button do something. A few days later I decide I don't want this button anymore. I would just click delete on the form designer, but it leaves the variable name and onclick function in the .h and .cpp files (when programming in C++) or the onclick method (in C#). I would then have to go and find all traces of the button and delete the code manually. I want to know if there is a "one-click" solution for removing the button like the "one-click" method for creating (well, it's not exactly one click to generate the variable and method, but it's not having to visit more than one different place to make it work either).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Telerik JustCode 做到了这一点 - 以及其他非常好的事情。也就是说,它可以让您知道您何时没有在项目中使用某些内容,并将其显示为警告或错误,作为相关代码的超链接。
Telerik JustCode does this - and other really nice things. That is, it lets you know when you're not using something in your project and displays it as a warning or error as a hyperlink to the code in question.