c# - How to determine inherited class in an array of type? -


say have these class:

class animal;  class tiger: animal; class bear: animal; class giraffe: animal; 

and array:

animal[] p = [new tiger(), new bear(), giraffe()] 

how determine that:

(p[0] tiger) 

i got message p[0] animal, not tiger

have tryed ?

p[0].gettype() == typeof(tiger) 

Popular posts from this blog

Php - Delimiter must not be alphanumeric or backslash -

c# - How to change the "Applies To" field under folder auditing options programatically (.NET) -

c++ - Ambiguity when using boost::assign::list_of to construct a std::vector -