Ejemplo n.º 1
0
    public static int LastIndexOf <T>(this IList <T> source, Func <T, bool> predicate)
    {
        Assert.IsNotNull(source);

        const int minIndex = 0;
        var       maxIndex = source.Count - 1;

        return(LinearSearch.LastIndexOf(minIndex, maxIndex, index => predicate(source[index])));
    }
Ejemplo n.º 2
0
    public static int LastIndexOf <T>(this IList <T> source, Func <T, bool> predicate)
    {
        ArgumentNullException.ThrowIfNull(source);

        const int minIndex = 0;
        var       maxIndex = source.Count - 1;

        return(LinearSearch.LastIndexOf(minIndex, maxIndex, index => predicate(source[index])));
    }
Ejemplo n.º 3
0
        private void FindPrevious(int startIndex)
        {
            var items = ListBox.Items.Cast <ListBoxItem <IObjectName> >().ToList();
            var index = LinearSearch.LastIndexOf(startIndex, items.Count - 1, currentIndex =>
            {
                var item = items[currentIndex];
                var name = item.Item.UnquotedName;
                return(name.IndexOf(_prefix) >= 0);
            });

            if (index >= 0)
            {
                ListBox.SelectedIndex = index;
            }
        }