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 -

trac - Modifying workflow to add a status and split on ticket type -

Delphi interface implements -