Use it or lose it, part deux [New Delay.FxCop code analysis rule helps identify uncalled public or private methods and properties in a .NET assembly]
**
This blog has moved to a new location and comments have been disabled.
All old posts, new posts, and comments can be found on The blog of dlaa.me.
See you there!
Comments
Anonymous
July 14, 2011
Here's one use case which will be difficult to check: I use the Cinch MVVM framework, which includes a Mediator class to pass messages. I can register for messages by adding an attribute to a method which will handle the message and simply registering the class itself with the Mediator. It then looks for methods with that attribute (via Reflection), keeps an internal list, and calls the method when the corresponding message is sent. So if that message is never sent, then that method is unused...Anonymous
July 15, 2011
Daniel Rose, Agreed. :) This scenario actually seems pretty similar to the XAML binding scenario: there are hints about a method's nature if you know the right place to look and there are ways to figure out such a method is called if you're willing to do a bunch of additional work.