Пример #1
0
        public static void InsertPairSortedById(this List <Util.Pair <int> > source,
                                                Util.Pair <int> element)
        {
            int index = source.FindLastIndex(e => e.Id < element.Id);

            if (index == -1)
            {
                source.Insert(0, element);
                return;
            }
            source.Insert(index + 1, element);
        }
Пример #2
0
        public static void InsertPairSorted(this List <Util.Pair <int> > source,
                                            Util.Pair <int> element)
        {
            int index = source.FindLastIndex(e => string.Compare(e.Name, element.Name) < 0);

            if (index == -1)
            {
                source.Insert(0, element);
                return;
            }
            source.Insert(index + 1, element);
        }