When making a connection in Linq, for example
from c in customers join x in somelistofcustomers on x.Id equals c.Id
you will get an error
x is not in the scope on the left side of the equal equation. Consider replacing expressions on either side of "equals"
Itβs simple enough to do, but I would like to explain why x is not in the scope on the left side, but somehow is in the area on the right side of equals
equals
This is due to how LINQ extends the compiler into the main extension methods.
Your request is translated into:
customers.Join(somelistofcustomers, c => x.Id, x => c.Id, (c, x) => ...)
- c => x.Id x => c.Id, , . LINQ - , , .
c => x.Id
x => c.Id
,
from identifier in {outer-sequence} join identifier2 in {inner-sequence} on {outer-key-selector} equals {inner-key-selector}
identifier {outer-key-selector} , identifier2 {inner-key-selector} - , .
identifier
{outer-key-selector}
identifier2
{inner-key-selector}