I have a list of Persons inside a Company Class.
public class Company{
IList<Person> persons;
}
Then I have a List of companies,
IList<Company> companies;
Now I have a name (say "Lasantha"). If this name is a part of the name of any person in a company, I want to find that company. I tried using companies.Contains() method. I overrided the object.Equals method, inside the Person class as this,
public override bool Equals(object o)
{
var other = o as Person;
return this.Name.ToLower().Contains(other.Name.ToLower());
}
But this is not working. It's not calling this Equal method as well. Can someone help me please.
Thank you.