Vlad Kuleshov
Vlad Kuleshov

Reputation: 21

Linq complex queries C#

i have this:

int item = particleEdges.ElementAt(i).Key;
Point3 hashPoint = particleEdges[item][j].hashEdge;

var hashList = particleEdges 
    .Where(p => p.Value.Any(q => q.hashEdge == hashPoint))
    .Select(r => r.Key != item)
    .ToList();

How to exclude "item" from hashList? Broke my head. Linq doesn't want to open to me.

Upvotes: 1

Views: 31

Answers (1)

Vlad Kuleshov
Vlad Kuleshov

Reputation: 21

var hashList = particleEdges
    .Where(p => p.Value.Any(q => q.hashEdge == hashPoint))
    .Where(r => r.Key != item)
    .Select(s => s.Key)
    .ToList();

Upvotes: 1

Related Questions