내가 약속 목록을 갖고 있고 루프 대신에 몇 주 안에 그 약속을 얻고 싶다면 예. 루프를 통과하여 주를 얻으려면
public class appointments
{
public string Appointment { get; set; }
public DateTime Start { get; set; }
public string Location { get; set; }
}
List<appointments> appointment = new List<appointments>();
appointment.Add(new appointments() { Appointment = "meeting", Start = new DateTime(2013, 01,02), Location = "office"});
appointment.Add(new appointments() { Appointment = "lunch", Start = new DateTime(2013, 01, 07), Location = "cafe" });
appointment.Add(new appointments() { Appointment = "meeting", Start = new DateTime(2013, 01, 08), Location = "cityhall" });
appointment.Add(new appointments() { Appointment = "dentist", Start = new DateTime(2013, 01, 14), Location = "dentist" });
는 지금은
2013-01-02
2013-01-25
에 말에서 timeperiod를 원하고 STARTDATE 01-02는 시작 일주일이 될 것입니다.
따라서 02 ~ 08 사이의 항목은 1 주일 09-16 다른 항목과 끝까지 해당 주에는 7 일이 있습니다. 어떻게 목록을 반복하고 마지막 주까지 7 일을 추가하여 "주 브레이크 날짜"를 미리 계산하지 않고도 특정 주만 다른 방법으로 전달할 수 있습니까?
아래 코드는 주 동안 주 1 "치과 의사"와 "회의, 점심 식사, 회의"를 반환
월요일이나 일요일과 같이 특정 요일이 시작됩니다. 아니면, 7 일 동안 반복 작업을 원하십니까? – Jodrell