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

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -