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 1189 dni, 16 godzin, 22 minuty temu j_boczek 75 pokaż kod licznika zwiń

Wczytywanie artykułów...

Najaktywniejsi

1
(32 895,6)
2
(32 816,53)
3
(27 178,29)
4
(21 178,88)
5
(20 336,33)
6
(13 018,14)
7
(10 512,43)
8
(9 775,28)
9
(8 388,28)
10
(6 822,96)
11
(6 214,22)
12
(5 393,84)
13
(4 127,41)
14
(4 026,73)
15
(3 908,07)
16
(3 599,64)
17
(3 448,35)
18
(3 318,39)
19
(3 224,66)
20
(3 173,43)