так:
List<X> x = ...Select(x => x).ToList(); // List<T>
или
x.ForEach(x => x); // void
, поскольку вы не можете присвоить void
List<T>
.
var query = rep.GetIp() // in this line i have the error
.Where(x => x.CITY == CITY)
.GroupBy(y => o.Fam)
.Select(z => new IpDTO
{
IId = z.Key.Id,
IP = z.Select(x => x.IP).Distinct()
});
foreach (var dto in query)
{
foreach (var ip in dto.IP)
{
PAINTIP(ip);
}
}
или
var query = ....
.SelectMany(z => z.Select(x => x.IP).Distinct());
foreach (var ip in query)
{
PAINTIP(ip);
}