-
Notifications
You must be signed in to change notification settings - Fork 0
/
Example04-Order.linq
51 lines (43 loc) · 1023 Bytes
/
Example04-Order.linq
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<Query Kind="Statements" />
var wordList = "The quick brown fox jumps over the lazy dog".Split();
wordList.Dump();
var words =
from word in wordList
where word.Length > 3
orderby word.ToUpper()
orderby word.Length
select word;
words.Dump();
var words2 =
wordList.
Where(word => word.Length > 3).
OrderBy(word => word.ToUpper()).
OrderBy(word => word.Length).
Select(word => word);
words2.Dump();
var words3 =
from word in wordList
where word.Length > 3
orderby word.ToUpper(), word.Length
select word;
words3.Dump();
var words4 =
wordList.
Where(word => word.Length > 3).
OrderBy(word => word.ToUpper()).
ThenBy(word => word.Length).
Select(word => word);
words4.Dump();
var words5 =
from word in wordList
where word.Length > 3
orderby word.ToUpper() descending, word.Length
select word;
words5.Dump();
var words6 =
wordList.
Where(word => word.Length > 3).
OrderByDescending(word => word.ToUpper()).
ThenBy(word => word.Length).
Select(word => word);
words6.Dump();