I am trying to run this code, but a is always null. I made sure that there’s a Name, why does it always return null?
public Animal FindAnimal(string Name)
{
Animal a = Animals.Find(
delegate(Animal bk)
{
return bk.AnimalName.ToLower() == Name.ToLower();
}
);
return a;
}
Your code looks fine to me. Here are some small optimizations though:
EDIT
Test of code: