public override DateTime?GetInstance(int year) { if (dayCache.ContainsKey(year)) { return(dayCache[year]); } var easter = EasterCalculator.CalculateEasterDate(year); var date = easter.AddDays(daysOffset); dayCache.Add(year, date); return(date); }
public override DateTime?GetInstance(int year) { return(dayCache.GetOrAdd(year, () => EasterCalculator.CalculateEasterDate(year).AddDays(daysOffset))); }