private void btnCreateTreatment_Click(object sender, EventArgs e) { var treatment = new Treatment { Date = dateTimePicker2.Value, Description = txtBoxTreatments.Text, Other = txtBoxOther.Text }; if (Treatments.Contains(treatment)) { return; } Treatments.Add(treatment); lstBoxTreatments.Items.Add(treatment); lstBoxTreatments.Refresh(); }
protected bool Equals(Treatment other) { return(Key == other.Key); }