//public bool Equals(Person other) //{ // if (this.uniqueSsn == other.SSN) // return true; // else // return false; //} public bool Equals(Person other) { if (FirstName == other.FirstName) return true; else return false; }
public static void TestStringWithDictionary() { try { Dictionary<Person, Person> dict = new Dictionary<Person, Person>(); Person p1 = new Person("pralay", "patoria"); dict.Add(p1, p1); Person p2 = new Person("pralay", "patoria"); dict.Add(p2, p2); Person p3 = dict[p2]; } catch (Exception ex) { Console.WriteLine(ex); } }