views:

90

answers:

4

If I want to know if a class inherits IDisposable I have to Go To Definition in each of its parent classes and interfaces?

Isn't there an easier way?

+4  A: 

Put an instance of the class in question in a using statement. The compiler will tell you if it is possible with that class or not.

flq
@Frank your solution is the easiest/fastest so far
Jader Dias
Heh, nice trickery frank.
Nathan Taylor
A: 

Idisposible Temp = class as Idisposible

If(temp== null) { //Do nothing

}

saurabh
A: 
bool implementsIDisposable = (classInstance is IDisposable);
Wil P
+3  A: 

If you have resharper installed, you can use type hierarchy (Crl + E, H) to view it quickly.

Russel Yang
Very nice, I never knew that.
Callum Rogers
In my resharper version it's Ctrl+Alt+H, and still +1
Oren A
there are two types of key bindings. I am using Visual studio one.
Russel Yang