public void EnterVehicleToGarage(VehicleRegistrationForm i_RegistrationForm) { if (r_DictionaryOfAllPatient.ContainsKey(i_RegistrationForm.Vehicle.LicenceNumber) == true) { throw new ArgumentException("Key Exist Already (Something Went Wrong)"); //// catch in case and ////m_DictionaryOfAllpatient[i_NewVehicle].ChangeStatusOfFixToInProgress(); } else { r_DictionaryOfAllPatient.Add(i_RegistrationForm.Vehicle.LicenceNumber, i_RegistrationForm); } }
// Overriding Object.Equals using this.GetHasCode as the logic for comaprison public override bool Equals(object io_obj) { bool eqauls = false; if (io_obj != null) { VehicleRegistrationForm toCompareTo = io_obj as VehicleRegistrationForm; if (toCompareTo != null) { eqauls = this.GetHashCode() == toCompareTo.GetHashCode(); } } return(eqauls); }