주소 집합이 다른 주소 항목이 있습니다. 각 주소 항목에는 AddressType, City, Zipcode 및 기타 항목이 있습니다. 일부 사용자가 새 addressType을 추가하고 Addressses 모음에 이미 AddressType이 나열되어 있으면 이미 나열되어 있다는 경고를 보내는 확인서를 작성 중입니다. 어떻게해야합니까? 몇 가지 코드를 첨부했습니다. 지금은 "Job Address"만 확인하고 있습니다. 세 가지 유형의 주소가 있습니다.ObservableCollection에서 중복을 확인하는 방법은 무엇입니까?
if (Addresses.Any
(a => a.AddressType =="Job Address"))
{
DialogManager.ShowMessageBox(("The type has already been listed "),
MessageBoxButton.OKCancel);
}
첫 번째 작업에 감사드립니다. 나는 아직도 잘 모릅니다. 어떻게 작동하는지 설명해 주시겠습니까? –
@C_looksharp : 좀 더 자세한 내용을 포함하도록 답변을 업데이트했습니다. – user7116