public PrintersItem AddUniqueItem(string strPrinter) { if (!string.IsNullOrEmpty(strPrinter) && strPrinter.Trim() != string.Empty) { var printersItem = new PrintersItem(); printersItem.Printer = strPrinter.Trim(); if (Items.Contains(printersItem, new CaseInsensitivePrinterItemComparer <PrintersItem>())) { return(Items.FirstOrDefault(i => i.Printer.ToLower() == printersItem.Printer.ToLower())); } Items.Add(printersItem); return(printersItem); } return(null); }
public override int GetHashCode(PrintersItem obj) { return(obj.GetHashCode()); }
public override bool Equals(PrintersItem x, PrintersItem y) { return(StringComparer.OrdinalIgnoreCase.Equals(x.Printer.Trim(), y.Printer.Trim())); }