[Solved] Lambda expressions in c#


Try Select instead of Where to get a list of all can_main_key values:

var candidate = db_can_records.CandidateMains.Select(m => m.can_main_key).ToList();

To get all the values for a single row of CandidateMains where you know the key try:

var candidate = db_can_records.CandidateMains.FirstOrDefault(m => m.can_main_key == variableContainingRequiredId);

solved Lambda expressions in c#