How do you find all the empty methods of a specific type defined in a project? an example use case would be to find all empty Page_Load methods defined in an Asp.Net application.
In the visual studio find-tool, set it to use Regular Expressions. Use this expression to find empty methods.
void\ .*\(*\)(\ |(\r\n))*{(\ |(\r\n))*}
To find empty Page_Load methods:
void\ (Page_Load).*\(*\)(\ |(\r\n))*{(\ |(\r\n))*}
All these approaches would work for "void" methods. For other types, you can change the expression or further generalize the expression to match any kind of return type.
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