14
Yazım Denetimi: typeof, GetType, ya da?
Birçok kişinin aşağıdaki kodu kullandığını gördüm: Type t = typeof(obj1); if (t == typeof(int)) // Some code here Ama bunu da yapabileceğini biliyorum: if (obj1.GetType() == typeof(int)) // Some code here Veya bu: if (obj1 is int) // Some code here Şahsen, en sonuncunun en temiz olduğunu hissediyorum, ama özlediğim …