Monday, March 23, 2009

Find Users of method through inheritor

So you have a method defined on an abstract base class, and you are going be messing with it. Someone decided to hang a deep inheritance hierarchy (deep to me means three levels or more) on the class. You want to know who is using an inherited method.

What G (Tim Gifford) did was pretty simple, but mighty handy. He just declared an override method on the abtract class's method, and used resharper's methods (show usages, show inheritors).

Quick intelligence, little real effort, and you delete the override method when you're done.

This is almost as nice as Dave Chelimsky's trick of commenting out a variable declaration in order to see where the variable is used. In VS.NET + Resharper, all the usages turn red. :-)