C# Client Library
A C# Client Library for the AnalyzeRe REST API
Loading...
Searching...
No Matches
ReportingPeriod.cs
Go to the documentation of this file.
1using System;
2using System.Runtime.Serialization;
4
5namespace AnalyzeRe.Metrics
6{
9 public class ReportingPeriod : APIType, IEquatable<ReportingPeriod>
10 {
11 #region Public Properties
15 [DataMember(Order = 2)]
16 [PropertyAlias(new[] { "start", "reporting_period_begin" })]
17 public DateTime? begin { get; set; }
18
22 [DataMember(Order = 3)]
23 [PropertyAlias("reporting_period_end")]
24 public DateTime? end { get; set; }
25 #endregion Public Properties
26
27 #region Constructor
37 public ReportingPeriod(DateTime? begin = null, DateTime? end = null)
38 {
39 this.begin = begin;
40 this.end = end;
41 if (end != null && begin != null && end <= begin)
42 throw new ArgumentException("When both a begin and end date are specified, " +
43 "the begin date must be less than end date.");
44 }
45 #endregion Constructor
46
47 #region Equality Overrides
51 public bool Equals(ReportingPeriod other)
52 {
53 return other != null &&
54 (begin?.Equals(other.begin) ?? other.begin == null) &&
55 (end?.Equals(other.end) ?? other.end == null);
56 }
57
61 public override bool Equals(object obj)
62 {
63 ReportingPeriod objReportingPeriod = obj as ReportingPeriod;
64 return Equals(objReportingPeriod);
65 }
66
69 public override int GetHashCode()
70 {
71 return new { begin, end }.GetHashCode();
72 }
73 #endregion Equality Overrides
74 }
75}
Base class used by all types and resources.
Definition APIType.cs:8
Specifies one or more aliases to be used as synonyms for the property's name.
A reporting period which dictates optional begin and end dates to constrain what event losses are inc...
DateTime? end
(Optional) The exclusive end date of the reporting period. If specified, event losses occurring on or...
DateTime? begin
(Optional) The inclusive start date of the reporting period. If specified, event losses occurring bef...
override int GetHashCode()
Get the HashCode for this ReportingPeriod.
bool Equals(ReportingPeriod other)
Determine if this ReportingPeriod is equivalent to another.
ReportingPeriod(DateTime? begin=null, DateTime? end=null)
Construct a new reporting period.
override bool Equals(object obj)
Determine if this ReportingPeriod is equivalent to another.