-
-
Notifications
You must be signed in to change notification settings - Fork 144
Expand file tree
/
Copy pathUserDescription.cs
More file actions
49 lines (40 loc) · 1.68 KB
/
Copy pathUserDescription.cs
File metadata and controls
49 lines (40 loc) · 1.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
using System;
namespace Exceptionless.Models.Data {
public class UserDescription : IData {
public UserDescription() {
Data = new DataDictionary();
}
public UserDescription(string emailAddress, string description) : this() {
if (!String.IsNullOrWhiteSpace(emailAddress))
EmailAddress = emailAddress.Trim();
if (!String.IsNullOrWhiteSpace(description))
Description = description.Trim();
}
public string EmailAddress { get; set; }
public string Description { get; set; }
/// <summary>
/// Extended data entries for this user description.
/// </summary>
public DataDictionary Data { get; set; }
protected bool Equals(UserDescription other) {
return string.Equals(EmailAddress, other.EmailAddress) && string.Equals(Description, other.Description) && Equals(Data, other.Data);
}
public override bool Equals(object obj) {
if (ReferenceEquals(null, obj))
return false;
if (ReferenceEquals(this, obj))
return true;
if (obj.GetType() != this.GetType())
return false;
return Equals((UserDescription)obj);
}
public override int GetHashCode() {
unchecked {
var hashCode = EmailAddress == null ? 0 : EmailAddress.GetHashCode();
hashCode = (hashCode * 397) ^ (Description == null ? 0 : Description.GetHashCode());
hashCode = (hashCode * 397) ^ (Data == null ? 0 : Data.GetCollectionHashCode());
return hashCode;
}
}
}
}