using System; using System.Linq; abstract class Customer { public int id; public string name; public double balance; } class NormalCustomer: Customer { } class SubscriberCustomer:Customer { public int LandMinutes; public int MobileMinutes; } public class Test { public static void Main() { Customer[] customers = new Customer[5]; customers[0]=new NormalCustomer(); customers[1] = new NormalCustomer(); customers[2] = new SubscriberCustomer(); customers[3] = new NormalCustomer(); customers[4] = new SubscriberCustomer(); var groupedCustomers = customers.GroupBy(c => c.GetType()).ToList(); foreach(var type in groupedCustomers) { Console.WriteLine(type.Key.Name + ", count: " + type.Count()); } } }