Yonatan Karni
Yonatan Karni

Reputation: 977

quick way to determine number of methods in an interface / class

is there a quick way to tell the number of methods in an interface/class in VS2008? using Resharper? Using NDepend?

Upvotes: 4

Views: 6293

Answers (2)

Rob Church
Rob Church

Reputation: 6943

Try the immediate window (Debug -> Windows -> Immediate)

typeof(System.Windows.Input.ICommand).GetMethods().GetLength(0);

In design time, the immediate window has scope to the currently selected project in the solution explorer - if that makes it tricky to access the interface you're after, then set a breakpoint somewhere you know you can access this interface, debug the application and try again in the immediate window.

Upvotes: 6

Paul Ruane
Paul Ruane

Reputation: 38580

(Assuming you don't mean programatically.) In Resharper, from the Resharper menu, select Windows then File Structure. This gives you an overview of the entire file you are in, listing the regions, types, fields, properties, events and methods in a hierarchy.

See the feature description which includes a screenshot.

Edit: just noticed this window has an 'export' function on the toolbar, so you could export to your favourite text editor and use editor's line count functionality (or use a command-line tool, such as 'wc -l').

Alternatively, especially if you don't have Resharper, you can just view the assembly in the Visual Studio Object Browser.

Upvotes: 5

Related Questions