LInq Order By and Order By Desc?

Don't use multiple OrderBy calls - use OrderBy followed by ThenBy : var query = myList. Where(x => x. Item!

= "SF" && x. AdSize == minadSize) . OrderBy(x => x.

ManufacturingDate) . ThenBy(x => x. ExpiryDate); // Could add more ThenBy calls If you use OrderBy twice, it will reorder the already-ordered-by-date list by expiry-date, whereas I assume you only want to order by expiry date for items with an equal manufacturing date, which is what the above does Obviously there's a ThenByDescending method too.

For example: var query = people. OrderBy(x => x. LastName) .

ThenBy(x => x. FirstName) . ThenByDescending(x => x.

Age) . ThenBy(x => x. SocialSecurity).

Don't use multiple OrderBy calls - use OrderBy followed by ThenBy: var query = myList. Where(x => x. Item!

= "SF" && x. AdSize == minadSize) . OrderBy(x => x.

ManufacturingDate) . ThenBy(x => x. ExpiryDate); // Could add more ThenBy calls If you use OrderBy twice, it will reorder the already-ordered-by-date list by expiry-date, whereas I assume you only want to order by expiry date for items with an equal manufacturing date, which is what the above does.

Obviously there's a ThenByDescending method too. For example: var query = people. OrderBy(x => x.

LastName) . ThenBy(x => x. FirstName) .

ThenByDescending(x => x. Age) . ThenBy(x => x.

SocialSecurity).

Thanks @Jon I was wondering that there must be something for this scenario – Deepesh Jun 10 at 11:46.

OrderBy(x => x. ThenBy(x => x. Var query = people.

OrderBy(x => x. ThenBy(x => x. ThenByDescending(x => x.

ThenBy(x => x.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions