Example #1
0
 public bool Contains(TestObject value)
 {
     return(IndexOf(value) >= 0);
 }
Example #2
0
 public virtual int IndexOf(TestObject value)
 {
     return(Array.IndexOf(this._array, value, 0, this._count));
 }
 public void WithNonSerializableObject()
 {
     TestObject o = new TestObject();
     Assert.IsFalse(o is ISerializable);
     Assert.IsFalse(IsSerializable(o));
     TrySerialization(o);
 }
Example #4
0
 public virtual int BinarySearch(TestObject value)
 {
     return(Array.BinarySearch(this._array, 0, this._count, value));
 }
 public virtual void Remove(TestObject value)
 {
     int index = IndexOf(value);
     if (index >= 0) RemoveAt(index);
 }
 public virtual TestObject[] ToArray()
 {
     TestObject[] array = new TestObject[this._count];
     Array.Copy(this._array, array, this._count);
     return array;
 }
 public virtual int IndexOf(TestObject value)
 {
     return Array.IndexOf(this._array, value, 0, this._count);
 }
        public virtual int Add(TestObject value)
        {
            if (this._count == this._array.Length)
                EnsureCapacity(this._count + 1);

            ++this._version;
            this._array[this._count] = value;
            return this._count++;
        }
 public virtual void CopyTo(TestObject[] array)
 {
     CheckTargetArray(array, 0);
     Array.Copy(this._array, array, this._count);
 }
 public virtual void CopyTo(TestObject[] array, int arrayIndex)
 {
     CheckTargetArray(array, arrayIndex);
     Array.Copy(this._array, 0, array, arrayIndex, this._count);
 }
 public bool Contains(TestObject value)
 {
     return (IndexOf(value) >= 0);
 }
 public virtual int BinarySearch(TestObject value)
 {
     return Array.BinarySearch(this._array, 0, this._count, value);
 }
        public virtual void AddRange(TestObject[] array)
        {
            if (array == null)
                throw new ArgumentNullException("array");

            if (array.Length == 0) return;
            if (this._count + array.Length > this._array.Length)
                EnsureCapacity(this._count + array.Length);

            ++this._version;
            Array.Copy(array, 0, this._array, this._count, array.Length);
            this._count += array.Length;
        }
Example #14
0
 public virtual TestObject[] ToArray()
 {
     TestObject[] array = new TestObject[this._count];
     Array.Copy(this._array, array, this._count);
     return(array);
 }
        public virtual void Insert(int index, TestObject value)
        {
            if (index < 0)
                throw new ArgumentOutOfRangeException("index",
                                                      index, "Argument cannot be negative.");

            if (index > this._count)
                throw new ArgumentOutOfRangeException("index",
                                                      index, "Argument cannot exceed Count.");

            if (this._count == this._array.Length)
                EnsureCapacity(this._count + 1);

            ++this._version;
            if (index < this._count)
                Array.Copy(this._array, index,
                           this._array, index + 1, this._count - index);

            this._array[index] = value;
            ++this._count;
        }
Example #16
0
 public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object text_obj)
 {
     if (text_obj is string)
     {
         string text = (string) text_obj;
         TestObject tb = new TestObject();
         string[] split = text.Split(new char[] {'_'});
         tb.Name = split[0];
         tb.Age = int.Parse(split[1]);
         return tb;
     }
     return base.ConvertFrom(context, culture, text_obj);
 }
        public TestObjectList(TestObject[] array)
        {
            if (array == null)
                throw new ArgumentNullException("array");

            this._array = new TestObject[array.Length];
            AddRange(array);
        }