I have this function where I’m trying to filter my position to everyone else in a table.
Given the table is Users:
name(string), int(position)
"joe", 4
"john", 3
"lee", 40
Lets say I’m joe and my position is 4. How can I with Linq filter det list, limiting the distance between 2 points to be 5? In this case for joe the result list will only contain “john”? since the distance between joe and john is 1, but joe and lee’s distance is 36 and therefore larger then 5.
I know my position and pass it in as a variable of a function:
public void FilterList(string myName, int myPos)
{
var list = ?? (Linq magic)
}
I also need to filter out myself.
1 Answer