Exemplo n.º 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());
            }
        }
Exemplo n.º 2
0
 void IList.Remove(object item)
 {
     if (GDAList <T> .IsCompatibleObject(item))
     {
         this.Remove((T)item);
     }
 }
Exemplo n.º 3
0
 internal Enumerator(GDAList <T> list)
 {
     this.list    = list;
     this.index   = 0;
     this.version = list._version;
     this.current = default(T);
 }
Exemplo n.º 4
0
 private static void VerifyValueType(object value)
 {
     if (!GDAList <T> .IsCompatibleObject(value))
     {
         throw new ArgumentException();
     }
 }
Exemplo n.º 5
0
        int IList.Add(object item)
        {
            GDAList <T> .VerifyValueType(item);

            this.Add((T)item);
            return(this.Count - 1);
        }
Exemplo n.º 6
0
 int IList.IndexOf(object item)
 {
     if (GDAList <T> .IsCompatibleObject(item))
     {
         return(this.IndexOf((T)item));
     }
     return(-1);
 }
Exemplo n.º 7
0
 bool IList.Contains(object item)
 {
     if (GDAList <T> .IsCompatibleObject(item))
     {
         return(this.Contains((T)item));
     }
     return(false);
 }
Exemplo n.º 8
0
        object IList.this[int index]
        {
            get
            {
                return(this[index]);
            }
            set
            {
                GDAList <T> .VerifyValueType(value);

                this[index] = (T)value;
            }
        }
Exemplo n.º 9
0
        public GDAList <TOutput> ConvertAll <TOutput>(Converter <T, TOutput> converter)
        {
            if (converter == null)
            {
                throw new ArgumentNullException("converter");
            }
            GDAList <TOutput> list = new GDAList <TOutput>(this._size);

            for (int i = 0; i < this._size; i++)
            {
                list._items[i] = converter(this._items[i]);
            }
            list._size = this._size;
            return(list);
        }
Exemplo n.º 10
0
        public GDAList <T> GetRange(int index, int count)
        {
            if ((index < 0) || (count < 0))
            {
                throw new ArgumentOutOfRangeException((index < 0) ? "index" : "count", "ArgumentOutOfRange_NeedNonNegNum");
            }
            if ((this._size - index) < count)
            {
                throw new ArgumentException("Argument_InvalidOffLen");
            }
            GDAList <T> list = new GDAList <T>(count);

            Array.Copy(this._items, index, list._items, 0, count);
            list._size = count;
            return(list);
        }
Exemplo n.º 11
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);
        }
Exemplo n.º 12
0
        void IList.Insert(int index, object item)
        {
            GDAList <T> .VerifyValueType(item);

            this.Insert(index, (T)item);
        }