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)