Here are two classes of C # ...
public class Address
{
public string Country;
public string City;
}
public class Traveller
{
public string Name;
public List<Address> TravelRoute;
}
... and a list of data (filled out somewhere) ...
List<Traveller> Travellers;
... and then this LINQ query:
var result = from t in Travellers
where t.TravelRoute.Any(a => a.Country == "F")
select t;
foreach (var t in result)
System.Console.WriteLine(t.Name);
I do not understand the request: what does the function "Any" mean and what does the operator "=>" do?
Can someone explain to me what is going on in this code? Thank!
source
share