/// <summary> /// Copy constructor /// </summary> /// <param name="di">The day instance to copy</param> public DayInstance(DayInstance di) { if (di != null) { this.Instance = di.Instance; this.DayOfWeek = di.DayOfWeek; } }
//===================================================================== /// <summary> /// This is overridden to allow proper comparison of DayInstance objects /// </summary> /// <param name="obj">The object to which this instance is compared</param> /// <returns>Returns true if the object equals this instance, false if it does not</returns> public override bool Equals(object obj) { DayInstance d = obj as DayInstance; if (d == null) { return(false); } return(this == d || (this.Instance == d.Instance && this.DayOfWeek == d.DayOfWeek)); }
/// <summary> /// Get a description of the day instance /// </summary> /// <returns>A string describing the day instance (i.e. 1st Monday from end).</returns> public string ToDescription() { string suffix = DayInstance.NumericSuffix(instance); if (instance == 0) { return(String.Format(CultureInfo.InvariantCulture, "{0} {1}", LR.GetString("DIAny"), CultureInfo.CurrentCulture.DateTimeFormat.DayNames[(int)dow])); } if (instance < 0) { return(String.Format(CultureInfo.InvariantCulture, "{0}{1} {2} {3}", instance * -1, suffix, CultureInfo.CurrentCulture.DateTimeFormat.DayNames[(int)dow], LR.GetString("DIFromEnd"))); } return(String.Format(CultureInfo.InvariantCulture, "{0}{1} {2}", instance, suffix, CultureInfo.CurrentCulture.DateTimeFormat.DayNames[(int)dow])); }
/// <summary> /// Copy constructor /// </summary> /// <param name="di">The day instance to copy</param> public DayInstance(DayInstance di) { if(di != null) { this.Instance = di.Instance; this.DayOfWeek = di.DayOfWeek; } }