14
Sprawdzanie typu: typeof, GetType, czy jest?
Widziałem wiele osób używających następującego kodu: Type t = typeof(obj1); if (t == typeof(int)) // Some code here Ale wiem, że możesz to zrobić: if (obj1.GetType() == typeof(int)) // Some code here Albo to: if (obj1 is int) // Some code here Osobiście uważam, że ostatni jest najczystszy, ale czy …