using System.Collections.Generic;
class Pet { public string Name { get; set; } }
List<Dog> dogs = new List<Dog> {
new Dog { Name = "Rover" },
new Dog { Name = "Spot" },
List<Cat> cats = new List<Cat> {
new Cat { Name = "Snowball" },
new Cat { Name = "Fluffy" },
IEnumerable<IEnumerable<Pet>> Corrals
get { return Corrals.SelectMany(list => list); }
void RemovePet(string name)
foreach (var list in Corrals)
var doomed = list.FirstOrDefault(pet => pet.Name == name);
if (doomed != null && list is System.Collections.IList ilist && !ilist.IsReadOnly)
foreach (var pet in Pets)
Console.WriteLine(pet.Name);
Console.WriteLine("---------------");
public static void Main() {