@@ -26,32 +26,25 @@ internal List<Result> AccessLinkListMatched(Query query, List<AccessLink> access
26
26
. OrderBy ( x => x . Type )
27
27
. ThenBy ( x => x . Nickname ) ;
28
28
29
- return queriedAccessLinks
30
- . Where ( x => x . Type == ResultType . Folder )
31
- . Select ( item =>
32
- resultManager . CreateFolderResult ( item . Nickname , item . Path , item . Path , query ) )
33
- . Concat (
34
- queriedAccessLinks
35
- . Where ( x => x . Type == ResultType . File )
36
- . Select ( item =>
37
- resultManager . CreateFileResult ( item . Path , query ) ) )
38
- . ToList ( ) ;
29
+ return queriedAccessLinks . Select ( l => l . Type switch
30
+ {
31
+ ResultType . Folder => resultManager . CreateFolderResult ( l . Nickname , l . Path , l . Path , query ) ,
32
+ ResultType . File => resultManager . CreateFileResult ( l . Path , query ) ,
33
+ _ => throw new ArgumentOutOfRangeException ( )
34
+
35
+ } ) . ToList ( ) ;
39
36
}
40
37
41
38
internal List < Result > AccessLinkListAll ( Query query , List < AccessLink > accessLinks )
42
39
=> accessLinks
43
40
. OrderBy ( x => x . Type )
44
41
. ThenBy ( x => x . Nickname )
45
- . Where ( x => x . Type == ResultType . Folder )
46
- . Select ( item =>
47
- resultManager . CreateFolderResult ( item . Nickname , item . Path , item . Path , query ) )
48
- . Concat (
49
- accessLinks
50
- . OrderBy ( x => x . Type )
51
- . ThenBy ( x => x . Nickname )
52
- . Where ( x => x . Type == ResultType . File )
53
- . Select ( item =>
54
- resultManager . CreateFileResult ( item . Path , query ) ) )
55
- . ToList ( ) ;
42
+ . Select ( l => l . Type switch
43
+ {
44
+ ResultType . Folder => resultManager . CreateFolderResult ( l . Nickname , l . Path , l . Path , query ) ,
45
+ ResultType . File => resultManager . CreateFileResult ( l . Path , query ) ,
46
+ _ => throw new ArgumentOutOfRangeException ( )
47
+
48
+ } ) . ToList ( ) ;
56
49
}
57
50
}
0 commit comments