-
Notifications
You must be signed in to change notification settings - Fork 1
/
Pair.cs
48 lines (41 loc) · 1001 Bytes
/
Pair.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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace itcsharp
{
public struct Pair<T> : IEquatable<Pair<T>>
{
public T First;
public T Second;
public Pair(T first, T second)
{
First = first;
Second = second;
}
public bool Equals(Pair<T> rhs)
{
return First.Equals(rhs.First) && Second.Equals(rhs.Second);
}
public override bool Equals(object rhs)
{
if (!GetType().IsInstanceOfType(rhs))
return false;
return Equals((Pair<T>)rhs);
}
public override int GetHashCode()
{
return First.GetHashCode() ^ Second.GetHashCode();
}
}
public struct Pair<T1, T2>
{
public T1 First;
public T2 Second;
public Pair(T1 first, T2 second)
{
First = first;
Second = second;
}
}
}