The StaDyn Programming Language
Source code documentation of StaDyn, a hybrid static and dynamic typing language.
Pair.cs
Go to the documentation of this file.
1 // --------------------------------------------------------------------------
3 // Project rROTOR
4 // --------------------------------------------------------------------------
5 // File: Pair.cs
6 // Author: Francisco Ortin - francisco.ortin@gmail.com
7 // Description:
8 // Generic pair of objects
9 // --------------------------------------------------------------------------
10 // Create date: 24-05-2006
11 // Modification date: 24-05-2007
13 
14 using System;
15 
16 namespace Tools {
20  public class Pair<FirstType,SecondType> {
21 
25  private FirstType first;
26 
30  private SecondType second;
31 
35  public FirstType First {
36  get { return first; }
37  set { first = value; }
38  }
39 
43  public SecondType Second {
44  get { return second; }
45  set { second = value; }
46  }
47 
48  public Pair(FirstType first, SecondType second) {
49  this.first = first;
50  this.second = second;
51  }
52 
53  public override bool Equals(object obj) {
55  if (pair == null)
56  return false;
57  return pair.First.Equals(First) && pair.Second.Equals(Second);
58  }
59 
60  public override int GetHashCode() {
61  return First.GetHashCode() * Second.GetHashCode();
62  }
63  }
64 }
Generic pair of objects
Definition: Pair.cs:20
Pair(FirstType first, SecondType second)
Definition: Pair.cs:48
override int GetHashCode()
Definition: Pair.cs:60
SecondType Second
The second element of the pair
Definition: Pair.cs:43
override bool Equals(object obj)
Definition: Pair.cs:53