Strona głównaSztuka programowania

Hi there! I’ve just had to sort some list alphabetically with specific values on top. Here is one of the possible solution. Worth to know:OrderBy sorts items in ascending order [a, b, c, d] [1,2,3,4]Can be use with boolean functionFalse = 0True = 1 So if we use: list.OrderBy(item => item == "Cat"); Item that equals „Cat” will be placed as last element, because as the only element returns true(1) as a result + as it was mention before OrderBy s...

Tagi: .Net, C#, dotnet, problem
Źródło: buildsolution.net
Dziel się z innymi:
OrderBy with boolean value | How to put specific values on top of the list | Build solution

Sztuka programowania 2813 dni, 5 godzin, 26 minut temu j_boczek 78 pokaż kod licznika zwiń

Wczytywanie artykułów...