childOf

  • Thread starter Thread starter Robert
  • Start date Start date
R

Robert

Hi.
My question is short and hopefully easy to answer.
Is there a method in the .NET framework wich could determine if a object is
child to another?

The metod i am lookign for should work something like this:

public static bool childOf(Object possibleChild, Object possibleParent)

I really cant figure out where to start looking it isn´t in the 'object'
class-members or 'type' class-members (maybe not so strange since the
hypotetic methodhead above is static). But where should I start looking?
 
Hi and thank you Joseph for your fast reply.
However your suggestion doesnt fully apply in my case, what I need is a
mehtod wich could determine if an object inherits from another object, not
only if it inherits directly but also if it is one or more 'generations'
down in the hierarky.

parent
|
child(gen. 1)
| |
child(gen 2) child(gen2)
| |
child(gen 3) child(gen 3)

I need a method wich indicate if 'child(gen3)' is a "child" to 'parent'
(even if this maybe should be called grandchild ;-)).

Maybe there isn´t such a method, but a seems foolish to start coding my own
if there allready exist one.

Any answer is wellcome.

Robert
 
Found the sollution to my problem..

System.type.isSubclassOf()
Was the method I was searching for...

Robert
 
Back
Top