using System;
using System.Collections;
using System.Collections.ObjectModel;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
public class Animal
{
public string Name;
public int Popularity;
public Animal(string name, int popularity)
{
Name = name; Popularity = popularity;
}
}
public class AnimalCollection : Collection
{
}
class Program
{
static void Main()
{
AnimalCollection animalAnimalCollection = new AnimalCollection();
animalAnimalCollection.Add(new Animal("Kangaroo", 10));
animalAnimalCollection.Add(new Animal("Lion", 20));
foreach (Animal a in animalAnimalCollection)
Console.WriteLine(a.Name);
}
}
The output:
Kangaroo
Lion