public void AddSuffix(int aOrder, string aValue) { if (string.IsNullOrEmpty(aValue) == false) { TXffix item = new TXffix(aOrder, aValue); InsertInSortedOrder(ref iSuffixes, item); } }
private void InsertInSortedOrder(ref List <TXffix> aList, TXffix aValue) { if (aList == null) { aList = new List <TXffix>(); aList.Add(aValue); } else { int pos = aList.BinarySearch(aValue, aValue as IComparer <TXffix>); if (pos < 0) { pos = ~pos; } aList.Insert(pos, aValue); } }