-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVisitRecord.cs
51 lines (44 loc) · 1.2 KB
/
VisitRecord.cs
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
50
51
using System;
namespace linq_slideviews
{
public class VisitRecord
{
public VisitRecord(int userId, int slideId, DateTime dateTime, SlideType slideType)
{
SlideType = slideType;
UserId = userId;
SlideId = slideId;
DateTime = dateTime;
}
public int UserId;
public int SlideId;
public SlideType SlideType;
public DateTime DateTime;
public override string ToString()
{
return $"{nameof(UserId)}: {UserId}, {nameof(SlideId)}: {SlideId}, {nameof(SlideType)}: {SlideType}, {nameof(DateTime)}: {DateTime}";
}
protected bool Equals(VisitRecord other)
{
return UserId == other.UserId && SlideId == other.SlideId && SlideType == other.SlideType && DateTime.Equals(other.DateTime);
}
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((VisitRecord) obj);
}
public override int GetHashCode()
{
unchecked
{
var hashCode = UserId;
hashCode = (hashCode*397) ^ SlideId;
hashCode = (hashCode*397) ^ (int) SlideType;
hashCode = (hashCode*397) ^ DateTime.GetHashCode();
return hashCode;
}
}
}
}