all groups > c# > march 2005 >
You're in the

c#

group:

ask if a class inherits from another



ask if a class inherits from another Rodolfo
3/31/2005 7:08:59 PM
c#: I need to do something like this

public class a : b{
....

}
....
a objecta = new a();

if (objecta "inheritsfrom" b)
do something;

There's a reserved word to do that?

TIA



Re: ask if a class inherits from another The Last Gunslinger
4/1/2005 1:32:30 AM
[quoted text, click to view]
if(objecta is b)// I think
or
b B = objecta as b;
if(!B is null)
//objecta inherits from b

HTH
AddThis Social Bookmark Button