'Remove unused C# code in Visual Studio
when working on a windows form I have accidently clicked on buttons and now I have part of code related to this click event. I don't need them and I would like to remove these parts from the code but, if I do, Visual Studio complains when compiling cause it search for that missing code. How can I get rid of unused click events on my code?
Solution 1:[1]
Here is another solution:
- Go to property (press F4), then go to an event.
- Select unwanted event, then right-click on event icon.
- Click 'Reset' to remove it from designer.cs automatically.
- Remove it in .cs file manually.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | TylerH |
