LINQ 정리노트 (2)
2015. 6. 25. 17:41
거침없이 배우는 LINQ - Fabrice Marguerie 외 지음, 이준석 옮김/지&선(지앤선) |
표준 질의 연산자
종류 |
질의 연산자 |
선별(filtering) |
OfType, Where |
투영(Projection) |
Select, SelectMany |
분할(Partitioning) |
Skip, SkipWhile, Take, TakeWhile |
조인(Join) |
GroupJoin, Join |
병합(Concatenation) |
Concat |
순차정렬(Ordering) |
OrderBy, OderByDescending, Reverse, ThenBy, ThenByDescending |
그룹화(Grouping) |
GroupBy, ToLookup |
집합연산(Set) |
Distinct, Except, Interset, Union |
변환(Conversion) |
AsEnumerable, AsQueryable, Cast, ToArray, ToDictionary, ToList |
동치성(Equality) |
SequenceEqual |
개체 선택(Element) |
ElementAt, ElementAtOrDefault, First, FirstOrDefault, Last, LastOfDefault, Single, SingleOrDefualt |
생성(Generation) |
DefaultIfEmpty, Empty, Range, Repeat |
계량화(Quantifiers) |
All, Any, Contains |
누적연산(Aggregation) |
Aggregate, Average, Count, LongCount, Max, Min, Sum |
질의 표현식 작성
from [ type ] id in source // from으로 시작하고 [ join [ type ] id in source on expr equals expr [ into id ] ] // 여러 개의 from, let, where 문 등이 올 수 있다. { from [ type ] id in source | let id = expr | where condition } [ orderby ordering, ordering, ... ] // 필요에 따라 사용 select expr | group expr by key // select 또는 group by로 끝난다. [ into id query ] // 필요에 따라 사용