Korero – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | using System; |
2 | |||
3 | namespace Korero.Database |
||
4 | { |
||
5 | public class DatabaseMessage : IEquatable<DatabaseMessage> |
||
6 | { |
||
7 | #region Public Enums, Properties and Fields |
||
8 | |||
9 | public string FirstName { get; } |
||
10 | |||
11 | public string LastName { get; } |
||
12 | |||
13 | public string Message { get; } |
||
14 | |||
15 | public DateTime Time { get; } |
||
16 | |||
17 | #endregion |
||
18 | |||
19 | #region Constructors, Destructors and Finalizers |
||
20 | |||
21 | public DatabaseMessage(string firstName, string lastName, string message, DateTime time) |
||
22 | { |
||
23 | FirstName = firstName; |
||
24 | LastName = lastName; |
||
25 | Message = message; |
||
26 | Time = time; |
||
27 | } |
||
28 | |||
29 | #endregion |
||
30 | |||
31 | #region Interface |
||
32 | |||
33 | public bool Equals(DatabaseMessage other) |
||
34 | { |
||
35 | if (ReferenceEquals(null, other)) |
||
36 | { |
||
37 | return false; |
||
38 | } |
||
39 | |||
40 | if (ReferenceEquals(this, other)) |
||
41 | { |
||
42 | return true; |
||
43 | } |
||
44 | |||
45 | return FirstName == other.FirstName && LastName == other.LastName && Message == other.Message && |
||
46 | Time.Equals(other.Time); |
||
47 | } |
||
48 | |||
49 | #endregion |
||
50 | |||
51 | #region Public Overrides |
||
52 | |||
53 | public override bool Equals(object obj) |
||
54 | { |
||
55 | if (ReferenceEquals(null, obj)) |
||
56 | { |
||
57 | return false; |
||
58 | } |
||
59 | |||
60 | if (ReferenceEquals(this, obj)) |
||
61 | { |
||
62 | return true; |
||
63 | } |
||
64 | |||
65 | if (obj.GetType() != GetType()) |
||
66 | { |
||
67 | return false; |
||
68 | } |
||
69 | |||
70 | return Equals((DatabaseMessage) obj); |
||
71 | } |
||
72 | |||
73 | public override int GetHashCode() |
||
74 | { |
||
75 | unchecked |
||
76 | { |
||
77 | var hashCode = FirstName != null ? FirstName.GetHashCode() : 0; |
||
78 | hashCode = hashCode * 397 ^ (LastName != null ? LastName.GetHashCode() : 0); |
||
79 | hashCode = hashCode * 397 ^ (Message != null ? Message.GetHashCode() : 0); |
||
80 | hashCode = hashCode * 397 ^ Time.GetHashCode(); |
||
81 | return hashCode; |
||
82 | } |
||
83 | } |
||
84 | |||
85 | #endregion |
||
86 | } |
||
87 | } |