using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ServerCore; /// /// 두 컬렉션의 키(Key)를 비교하는 기능을 제공하는 정적 유틸리티 클래스입니다. /// public static class KeyComparer { /// /// 두 개의 딕셔너리를 비교하여, 두 번째 딕셔너리(second)에만 존재하는 키(Key)들의 리스트를 반환합니다. /// 첫 번째 딕셔너리(first)에는 없고 두 번째 딕셔너리에 새로 추가된 키를 찾을 때 유용합니다. /// /// 딕셔너리의 키 타입 /// 딕셔너리의 값 타입 /// 비교의 기준이 되는 첫 번째 딕셔너리 /// 새로운 키를 찾을 대상이 되는 두 번째 딕셔너리 /// 두 번째 딕셔너리에만 존재하는 키의 리스트 public static List getKeysOnlyInSecond(Dictionary first, Dictionary second) where TKey : notnull where TValue : notnull { return second.Keys.Except(first.Keys).ToList(); } /// /// 두 개의 리스트를 비교하여, 두 번째 리스트(second)에만 존재하는 요소들의 리스트를 반환합니다. /// /// 리스트 요소의 타입 /// 비교의 기준이 되는 첫 번째 리스트 /// 새로운 요소를 찾을 대상이 되는 두 번째 리스트 /// 두 번째 리스트에만 존재하는 요소의 리스트 public static List getKeysOnlyInSecond(List first, List second) where TKey : notnull { return second.Except(first).ToList(); } }