I have a class Houseand I am creating List<House>with some new Houses. Now I would like to filter out my List' where the Name of the House equals"House 1".
How do I deal with this situation?
I tried houses.FindAll("House 1");, but this showed an error:
Argument 1: cannot be converted from 'string' to System.Predicate <"App.Page1.House">
class House
{
public House(string name, string location)
{
this.Name = name;
this.Location = location;
}
public string Name { private set; get; }
public string Location { private set; get; }
};
List<House> houses= new List<House>
{
new House("House 1", "Location 1"),
new House("House 2", "Location 4"),
new House("House 3", "Location 3"),
new House("House 4", "Location 2")
};
source
share