/// <summary> /// Initializes a new instance of the <see cref="TimeInterval"/> struct. /// </summary> /// <param name="startTime">The start time.</param> /// <param name="startInclusive">if set to <c>true</c> [start inclusive].</param> /// <param name="endTime">The end time.</param> /// <param name="endInclusive">if set to <c>true</c> [end inclusive].</param> public TimeInterval(DateTime startTime, bool startInclusive, DateTime endTime, bool endInclusive) : this() { this._flags = TimeInterval.TimeIntervalFlags.Constructing; this.Start = startTime; this.End = endTime; this.SetFlags(TimeInterval.TimeIntervalFlags.StartInclusive, startInclusive); this.SetFlags(TimeInterval.TimeIntervalFlags.EndInclusive, endInclusive); this.Constructing = false; this.ThrowIfInvalid(); }
private void SetFlags(TimeInterval.TimeIntervalFlags flags, bool on) { if (on) { this._flags |= flags; return; } this._flags &= ~flags; }