示例#1
0
        private int[] Find(string propertyName, object key, bool getFirst)
        {
            GDAList <int> itens = new GDAList <int>();
            Type          type  = typeof(T);
            int           count = 0;

            foreach (T o in this)
            {
                if (Match(type.GetProperty(propertyName).GetValue(o, null), key))
                {
                    if (getFirst)
                    {
                        return new int[] {
                                   count
                        }
                    }
                    ;
                    else
                    {
                        itens.Add(count);
                    }
                }
                count++;
            }
            if (getFirst)
            {
                return(null);
            }
            else
            {
                return(itens.ToArray());
            }
        }
示例#2
0
        public GDAList <T> FindAll(Predicate <T> match)
        {
            if (match == null)
            {
                throw new ArgumentNullException("match");
            }
            GDAList <T> list = new GDAList <T>();

            for (int i = 0; i < this._size; i++)
            {
                if (match(this._items[i]))
                {
                    list.Add(this._items[i]);
                }
            }
            return(list);
        }