Esempio n. 1
0
 public static WeekDTO CreateForWeekId(int weekId)
 {
     return(weeksByWeekId.GetOrAdd(weekId, (id) =>
     {
         var candidate = new WeekDTO(WeekEpoch);
         var candidateWeekId = 0;
         while (candidateWeekId != weekId)
         {
             candidate = candidate.Next();
             ++candidateWeekId;
         }
         return candidate;
     }));
 }
Esempio n. 2
0
 private int GetWeekId()
 {
     return(weekIdsByWeek.GetOrAdd(this, (week) =>
     {
         var candidate = new WeekDTO(WeekEpoch);
         var weekId = 0;
         while (candidate != this)
         {
             candidate = candidate.Next();
             ++weekId;
         }
         return weekId;
     }));
 }