if (gardenvlist.Count() == getava.Count())
{
}
else if(oceanvlist.Count() == getava.Count())
{
}
else if (cityvlist.Count() == getava.Count())
{
}
<
Use the overload which takes a predicate. Here is the signature:
public static int Count(this IEnumerable source,
Func predicate);
Imaging you have this:
public class Room
{
public string Name { get; set; }
}
Then you put them into a list:
var rooms = new List()
{
new Room { Name = "Living" },
new Room { Name = "Kitchen" }
};
You want to know how many rooms have the name "Living":
int count = rooms.Count(x => x.Name == "Living");