I am absolute n00b at LINQ.
Can code for GetAnimals() be written in LINQ?
class Farm
{
ObservableCollection<Animal> allAnimals = new ObservableCollection<Animal>();
public IEnumerable<T> GetAnimals<T>() where T: Animal
{
foreach (var a in allAnimals)
{
if (a.GetType() == typeof(T))
{
yield return (T)a;
}
}
}
}