namespace BuildingDirectory.Model; /// /// Represents a business card of a company employee /// public sealed class BusinessCard { /// /// Creates a new instance of a business card /// /// First name of the employee /// Last name of the employee /// Department the employee works at /// Phone number of the employee /// E-Mail address of the employee public BusinessCard(string firstName, string lastName, string department, string? phoneNumber, string eMail) { FirstName = firstName; LastName = lastName; Department = department; PhoneNumber = phoneNumber; EMail = eMail; } /// /// Gets the first name of the employee /// public string FirstName { get; } /// /// Gets the last name of the employee /// public string LastName { get; } /// /// Gets the name of the department the employee works at /// public string Department { get; } /// /// Gets the phone number of the employee /// public string? PhoneNumber { get; } /// /// Gets the E-Mail address of the employee /// public string EMail { get; } /// /// Determines if this object is equal to another /// /// Other object to compare to /// True if the objects are equal; false otherwise public override bool Equals(object? obj) { if (obj is not BusinessCard other) { return false; } return FirstName == other.FirstName && LastName == other.LastName; } /// /// Calculates the hash code for this object /// /// Numeric hash code // Uses XOR to combine the bits of each hash code public override int GetHashCode() => FirstName.GetHashCode() ^ LastName.GetHashCode(); }