rbulph Posted April 12, 2010 Posted April 12, 2010 Is there a way to quickly find all classes that override a given method? Maybe it would work like the "Find all References" item on the code context menu so you'd get a list of them in the Find Symbol Results window. This would be so useful because, without it, I'm having to look at all classes that inherit a class and might override a method in order to fully understand that method, and that's cumbersome. Any thoughts? Quote
Leaders snarfblam Posted April 12, 2010 Leaders Posted April 12, 2010 It's an interesting question. The thing is, there is no reason that the runtime would ever need this and it isn't a very common need, even when dealing with reflection. As far as I know reflection doesn't directly support that kind of analysis. I'm guessing that what you have is the best you can do: enumerate the types and examine those that derive from the class in question. Is this causing a performance issue? Or were you just looking for a better way? Quote [sIGPIC]e[/sIGPIC]
rbulph Posted April 12, 2010 Author Posted April 12, 2010 There's no performance issue, other than my own personal performance (!). It would be helpful to quickly be able to see how I was dealing with a method across the classes, rather than having to think about what classes I have that might override a method, and then check them all, opening extra windows in the process. There's so much that the Visual Studio does that I'm surprised this doesn't seem to have been dealt with, but perhaps I'm unusual in wishing for it. Quote
Administrators PlausiblyDamp Posted April 12, 2010 Administrators Posted April 12, 2010 As far as I am aware VS doesn't provide this functionality, I do know that the ReSharper plugin for VS does however. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Leaders snarfblam Posted April 13, 2010 Leaders Posted April 13, 2010 Oh... I thought you meant programatically. Quote [sIGPIC]e[/sIGPIC]
Administrators PlausiblyDamp Posted April 13, 2010 Administrators Posted April 13, 2010 This is possible in 2010 however, the View Call Heirachy will show overrides as well as the actual method calls. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
rbulph Posted April 13, 2010 Author Posted April 13, 2010 Yes I'm still using the 2005 version. Not sure that I can be bothered with all the hassle (and presumably expense) of upgrading. Quote
Administrators PlausiblyDamp Posted April 13, 2010 Administrators Posted April 13, 2010 Expense - definitely, hassle however should be very little. VS 2010 will let you target .Net 2, 3, 3.5 or 4 and will even allow a .Net 4 application to load assemblies from other versions of the framework at the same time. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
rbulph Posted April 14, 2010 Author Posted April 14, 2010 (edited) Or maybe it wouldn't be that hard to write an add-in myself. I remember doing this in the old Visual Basic. That way I can get it to do just what I want, and there's no time involved in figuring out what someone else's solution does. Or actually the Find Symbol Command does pretty much what I want. Anyone know how to add this to the code context menu? I've tried through Tools/Customize/Rearrange Commands but can't see how to add buttons to this menu. Edited April 14, 2010 by rbulph Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.