C # Requesting an object using multiple parameters

What am I doing wrong. I am getting an error that says the sequence has no arguments.

PumpSUM.tblcards card = ps.tblcards.First(p => (p.PinId == 1223 && p.CardId == 321));

      

+2


source to share


2 answers


This problem seems to occur when there is no first item to select. Better to use the FirstOrDefault function.



+3


source


Use Take(1)

or FirstOrDefault

instead.



0


source







All Articles