중첩 된 C 번호 목록에서 중복 값 제거하는 방법 :내가 모델 설정을 아래와 같이이
List<ReportScheduleModel> ReportSchedule
[0]->Day: 'Sunday'
[ReportTimes]: [0]->hourOfDay: '09'
minuteOfDay: '23'
reportType: 'Test1'
[1]->hourOfDay: '08'
minuteOfDay: '11'
reportType: 'Test2'
[1]->Day: 'Sunday'
[ReportTimes]: [0]->hourOfDay: '09'
minuteOfDay: '23'
reportType: 'Test1'
[1]->hourOfDay: '11'
minuteOfDay: '30'
reportType: 'Test1'
[2]->Day: 'Monday'
[ReportTimes]: [0]->hourOfDay: '09'
minuteOfDay: '23'
reportType: 'Test1'
: 나는 다음 목록 형식으로 내 컨트롤러에 다시 전체 목록을 전달할 수 있습니다
public class ReportScheduleModel
{
public string Day { get; set; }
public List<ReportTimes> reportTimes { get; set; }
}
public class ReportTimes
{
public byte hourOfDay { get; set; }
public byte minuteOfDay { get; set; }
public string reportType { get; set; }
}
을
위의 목록에서 ReportSchedule[0]
과 ReportSchedule[1]
은 모두보고 시간이 "09:23 Test1"과 똑같다는 것을 알 수 있습니다. 내가하려고하는 것은 이러한 중복 값이없는 목록에 도달하는 것입니다. 중복보고 시간 값 중 하나만 유지합니다. 따라서, 나의 이상적인 필터링 된 목록을 기준으로 위의 것 :
[0]->Day: 'Sunday'
[ReportTimes]: [0]->hourOfDay: '09'
minuteOfDay: '23'
reportType: 'Test1'
[1]->hourOfDay: '08'
minuteOfDay: '11'
reportType: 'Test2'
[1]->Day: 'Sunday'
[ReportTimes]: [0]->hourOfDay: '11'
minuteOfDay: '30'
reportType: 'Test1'
[2]->Day: 'Monday'
[ReportTimes]: [0]->hourOfDay: '09'
minuteOfDay: '23'
reportType: 'Test1'
[HashSet의] (http://msdn.microsoft.com/en-us/library/bb359438.aspx) : 다음은 예입니다. –