how to see public interface of the class? - visual-studio-2010

How can I check public interface of a class in Visual Studio to understand what really class can do?
In Eclipse I can use "Outline" pane for that.

Have a look at this Post
Productivity Power Tools Solutions Explorer should do the trick.

Maybe you can refer at this
Otherwise you just need to right click on the class name in the interface and choose "Go to definition".

Right click under the interface name and "Go to definition"

Related

What interfaces are implemented by a class?

I think it is a simple stuff, but I cannot find it.
Are there any easy way to know what interfaces a class implements? Directly or in its ancestor classes.
I have Visual Studio 2010 Pro without commercial addons.
Thanks.
Another way is to open Class View window (menu View -> Class View) and see it in a graphical representation under Base Types:
Also, make sure you've installed Productivity Power Tools because it allows you to see base / derived types, references, etc. through very handy interactive tool tips:
Not exactly what you asked, but you can press F12 on a class name (right click -> Go to definition) and then just look at the class Foo : IBar line.
You can see this in the Object Browser (under the "Base Types" folder). You will need to have the "Show Base Types" option checked though:

Visual Studio "Go to implementation "

On a right mouse click on a method call, we get a context menu with options "Go to definition" and "Go to implementation" options among others.
Why is the "Go to implementation" option sometimes missing?
For visual studio 2015, there is this extension: Go To Implementation
It's an extension that allows to go to the implementation of the selected class, method or property (useful when using interfaces). Similar to the ReSharper feature.
It also supports multiple implementations when found
Of course already exists in Visual Studio ! It is there since ever.
Right click on your code (Ex: property) an select "View Call Hierarchy". In Call Hierarchy window select the Implements folder.
There you are. Why Resharper ???
Of course is not that complex as go to implementation from resharper which allows direct interrogation on interface, but only a property, or a method from that interface should be enough. Ex:
public interface IModule
{
int Count { get; set; }
}
public class Module : Imodule
{
public int Count {get; set;}
}
public class Module2 : Imodule
{
public int Count {get; set;}
}
Right click on the property (anywhere - inside the class or inside the interface) and select "View Call Hierarchy", should say which class implements them, and therefore the whole Interface.
At the beginning we all love Resharper, with time, we all hate it !
This ReSharper context menu item "Go To Implementation" only shows up if there is an implementation for the base member.
It is not shows up in every place because ReSharper does not find itself on the base member that has been implemented.
http://www.jetbrains.com/resharper/features/navigation_search.html#Go_to_Implementation
I think that happens sometimes when you load a file individually that isn't part of a project. When you make a VC++ project, Visual studio generates an intellisense database. *.ncb in older versions, and *.sdf in 2010

How to show all implement instance of an interface method?

In my project, there are tons of interface classes used. I have difficulties in reading to understand the code since browsing the definition of the codes (by selecting the method name and pressing F12 or right click + go to Definition) just lead me to the interface.
Is there a way (built-in or addon) in Visual Studio 2010 to list out all of the instance of a method of an interface?
Hope to hear from you.
After a while, I found that just with VS 2010, I can archive this all alone: Use "Call Hierarchy"!
Place your cursor on any member of the interface class
Right click and choose "View Call Hierarchy"
Open the "Implements..." node in the "Call Hierarchy" pane.
That's it. Enjoy ^_^!
Resharper can do this and is an excellent addition to VS.net for many other reasons that you'll discover...

How to automatically generate an implementor of an interface in Visual Studio?

In Eclipse I can create a class with stub methods auto-generated for an interface. Surely this works in Visual Studio somehow, but for the life of me, I can't figure out how...
Any thoughts?
Yes you can. Type the interface name as usual and look for a smart tag to pop underneath the interface name. Expand that and it will give you menu options for implementing the interface.
The keyboard shortcut for this is Control + ..
Here's a good article on the code refactoring functionality in Visual Studio 2005.
Refactoring C# Code Using Visual Studio 2005
Type the name of the interface and either right click it (using the smart tag), or, my personal favorite, press ctrl + point. (No need to reach for the mouse ;) ).
In vb.net you just write class name
implement interface [press enter here]

Updating a class after changing its Interface

Say I add a function to an outstanding Interface.
In Visual Studio, within a class which implements it I can right click the Interface declaration and re-implement it. This will update the code to reflect the changes made. Is there anyway to do the same thing in eclipse?
It'd be nice if there was.
I've searched the net, alas no joy.
Put the cursor on the name of the class and press CTRL+1 to activate the quick-fix. That should offer the option of adding the new method.
UPDATE: BTW, here's a really handy list of Eclipse keyboard shortcuts. If you're on Mac, you can usually substitute ⌘ for CTRL.
You can also use the source menu. Select Source > Override/Implement methods.

Resources