I have a SQL table "tablex" with 3 columns(A, B ,C ).
The following lambada expression returns 10 rows.
var versions = versionRepository.GetVersions(a.id)
Column B of the 10 results store data as: 1,2,3,4,5,6,7,8,9,10
Can someone help me with the lambda expression to only get results for column C where b in (2,3,4).
So I should only get 3 rows of column C data.
Use the Where extension method to filter the data, and the Select extension method to get only the C property:
var versions =
versionRepository.GetVersions(a.id)
.Where(v => v.B >= 2 && v.B <= 4)
.Select(v => v.C);
(The part v => v.C is an example of a lambda expression.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With