Vereinsmeisterschaften  22aa7800eae54b428d40e835886cefe1fdefdfdf
This is a software that can be used to manage the internal competition of the swimming club Illertissen called "Vereinsmeisterschaften".
Loading...
Searching...
No Matches
PersonBasicEqualityComparer.cs
2{
10 public class PersonBasicEqualityComparer : IEqualityComparer<Person>
11 {
18 public bool Equals(Person x, Person y)
19 {
20 if (ReferenceEquals(x, y)) return true;
21 if (ReferenceEquals(x, null)) return false;
22 if (ReferenceEquals(y, null)) return false;
23 if (x.GetType() != y.GetType()) return false;
24
25 return (x.Name.ToUpper(), x.FirstName.ToUpper(), x.Gender, x.BirthYear).Equals((y.Name.ToUpper(), y.FirstName.ToUpper(), y.Gender, y.BirthYear));
26 }
27
33 public int GetHashCode(Person obj)
34 => obj == null ? 0 : (obj.Name.ToUpper(), obj.FirstName.ToUpper(), obj.Gender, obj.BirthYear).GetHashCode();
35 }
36}
Comparer that only uses the most basic properties of a Person to determine equality:
bool Equals(Person x, Person y)
Check if two Person objects are equal based on basic properties.
int GetHashCode(Person obj)
Get the hash code for a Person object based on basic properties.
Class describing a person.
Definition Person.cs:12
string FirstName
First name of the person.
Definition Person.cs:77
UInt16 BirthYear
Birth year of the person.
Definition Person.cs:99
string Name
Last name of the person.
Definition Person.cs:66
Genders Gender
Gender of the person.
Definition Person.cs:88