how does one go about counting the amount of a specific object type in an ArrayList in C#?
More specifically, I have three subclasses of base class ‘Letter’, ‘X’, ‘Y’ and ‘Z’. Various amounts of X, Y and Z objects have been created and added to an arraylist. I then need to count how many X objects are in that list. What’s the best way of going about this?
Cheers for any help guys/gals.
You can also use the OfType<T> Extension Method: