/// <summary> /// Initializes a new instance of the <see cref="FiftyTwoFiftyThreeWeekAccountingPeriodSystem"/> class. /// </summary> /// <param name="lastDayOfWeekInAccountingYear">The day of the week that the fiscal year always ends on.</param> /// <param name="anchorMonth">The month that the fiscal year end is anchored to. See <see cref="FiftyTwoFiftyThreeWeekMethodology"/>.</param> /// <param name="fiftyTwoFiftyThreeWeekMethodology">The methodology used to identify the last day of the accounting year.</param> /// <exception cref="ArgumentException"><paramref name="anchorMonth"/> is invalid.</exception> public FiftyTwoFiftyThreeWeekAccountingPeriodSystem( DayOfWeek lastDayOfWeekInAccountingYear, MonthOfYear anchorMonth, FiftyTwoFiftyThreeWeekMethodology fiftyTwoFiftyThreeWeekMethodology) { if (anchorMonth == MonthOfYear.Invalid) { throw new ArgumentException("anchor month is invalid", nameof(anchorMonth)); } this.LastDayOfWeekInAccountingYear = lastDayOfWeekInAccountingYear; this.AnchorMonth = anchorMonth; this.FiftyTwoFiftyThreeWeekMethodology = fiftyTwoFiftyThreeWeekMethodology; }
/// <summary> /// Initializes a new instance of the <see cref="FiftyTwoFiftyThreeWeekAccountingPeriodSystem"/> class. /// </summary> /// <param name="lastDayOfWeekInAccountingYear">The day of the week that the fiscal year always ends on.</param> /// <param name="anchorMonth">The month that the fiscal year end is anchored to. See <see cref="FiftyTwoFiftyThreeWeekMethodology"/>.</param> /// <param name="fiftyTwoFiftyThreeWeekMethodology">The methodology used to identify the last day of the accounting year.</param> /// <exception cref="ArgumentException"><paramref name="anchorMonth"/> is invalid.</exception> public FiftyTwoFiftyThreeWeekAccountingPeriodSystem( DayOfWeek lastDayOfWeekInAccountingYear, MonthOfYear anchorMonth, FiftyTwoFiftyThreeWeekMethodology fiftyTwoFiftyThreeWeekMethodology) { if (anchorMonth == MonthOfYear.Invalid) { throw new ArgumentOutOfRangeException(Invariant($"'{nameof(anchorMonth)}' == '{MonthOfYear.Invalid}'"), (Exception)null); } if (fiftyTwoFiftyThreeWeekMethodology == FiftyTwoFiftyThreeWeekMethodology.Unknown) { throw new ArgumentOutOfRangeException(Invariant($"'{nameof(fiftyTwoFiftyThreeWeekMethodology)}' == '{FiftyTwoFiftyThreeWeekMethodology.Unknown}'"), (Exception)null); } this.LastDayOfWeekInAccountingYear = lastDayOfWeekInAccountingYear; this.AnchorMonth = anchorMonth; this.FiftyTwoFiftyThreeWeekMethodology = fiftyTwoFiftyThreeWeekMethodology; }
public FiftyTwoFiftyThreeWeekAccountingPeriodSystem DeepCloneWithFiftyTwoFiftyThreeWeekMethodology(FiftyTwoFiftyThreeWeekMethodology fiftyTwoFiftyThreeWeekMethodology) { var result = new FiftyTwoFiftyThreeWeekAccountingPeriodSystem( this.LastDayOfWeekInAccountingYear.DeepClone(), this.AnchorMonth.DeepClone(), fiftyTwoFiftyThreeWeekMethodology); return(result); }