if you know the type you wish to check, for example
System.ComponentModel.Component, you can simiply do:
object o = <getobject>;
if (o is System.ComponentModel.Compnent) {
//do whatever,
}
otherwise
object o = <getobject>;
object c = <getdifferntObject>;
if (o.GetType().IsSubClassOf(c.GetType())) {
//do whatever
}
note, that in C#, the typeof() keyword can be used instead of the .GetType()
method.
"Jesper" <je****@hotmail.com> wrote in message
news:04****************************@phx.gbl...
Hi,
Is it possible to query an object for an ancestor. I.e.
determine if an object is derived from a certain type of
class.
thanx.
Jespr.