-1
There is the possibility to use the MAX
in expression consultations lambdas
, for example:
I would like to take all registration at the age of 18 years and get the only last record entered in the database, ie with the longest registration date.
Lista.FirstOrDefault(x => x.Idade.Equals(18) && x.DataCadastro);
You want to get two results?
– novic
This list is an auto field - increment ?
– novic
In lambda there is Max too:
Lista.Max(x => x.DataCadastro)
, assuming the List is already filtered (age)– Ricardo Pontual