728x90
Select, Where, OrderBy, List.Find(All)
- Select, Where, OrderBy 메서드들은 IEnumerable 인터페이스에서 제공하고 있다. 이 말은 IEnumerable을 상속하고 있는 모든 클래스에서 사용할 수 있음을 뜻한다.
- Find는 리스트이다.
- System.Collections에 있는 데이터 묶음 클래스가 있다. List, ArrayList, Dictionary, Stack, Queue등 거의 모든 Collections에서 사용이 가능하다.
- Func을 매개변수로 받을 수 있다.
- 함수로 그때 필요한 값을 찾아올 수 있다.
where
- 조건을 집어넣어 조건에 맞는 인스턴스 또는 값들을 가져온다.
Select
- Where과 달리 조건에 맞는 인스턴스가 아닌 그 값 자체를 가져온다.
Find
- 조건을 집어넣어 조건에 맞는 인스턴스 또는 값들을 가져온다.
- FindAll을 사용할 시 Where과 기능은 완전히 유사하지만 FindAll의 경우 반환 타입은 List<item>, where의 경우 IEnumerable<Item>이 된다.
OrderBy, OrderByDescending
- 매개변수로 넣은 멤버를 기준으로 값을 정렬한다.
참조
https://programming-mr.tistory.com/67
C# Select, Where, OrderBy, List.Find(All)
C# Where, Select, OrderBy, List.Find(All)를 정리해보려 합니다. 이 셋의 공통점을 정리해 보겠습니다. 1. 이 메서드들은 IEnumarable 인터페이스에서 제공하고 있습니다 (Find는 리스트). 이 말은 IEnumerable을 상
programming-mr.tistory.com
728x90
'언어 > C#' 카테고리의 다른 글
DebuggerNonUserCodeAttribute, GerneratedCodeAttribute, RepeatedField (0) | 2024.08.01 |
---|---|
ConcurrentDictionary<TKey, TValue> (0) | 2024.08.01 |
LINQ(Language Integrated Query), AsEnumerable Method (0) | 2024.07.31 |
ConstainsKey, AddOrUpdate 메서드, Stopwatch (0) | 2024.07.31 |
SocketAsyncEventArgs (0) | 2024.07.31 |