C# 自定义集合

using System;
using System.Collections;

namespace Lucia
{
    [Serializable]
    public sealed class ClassCollection : CollectionBase
    {
        public int Add(Class value)
        {
            return base.List.Add(value);
        }

        public void AddRange(Class[] values)
        {
            foreach (Class info in values)
            {
                this.Add(info);
            }
        }

        public void AddRange(IEnumerable @enum)
        {
            foreach (Class info in @enum)
            {
                this.Add(info);
            }
        }

        public bool Contains(Class value)
        {
            return base.List.Contains(value);
        }

        public int IndexOf(Class value)
        {
            return base.List.IndexOf(value);
        }

        public void Insert(int index, Class value)
        {
            base.List.Insert(index, value);
        }

        public void Remove(Class value)
        {
            base.List.Remove(value);
        }

        public void CopyTo(Class[] array, int index)
        {
            ICollection is2 = this;
            is2.CopyTo(array, index);
        }

        public Class[] ToArray()
        {
            Class[] array = new Class[base.Count];
            this.CopyTo(array, 0);
            return array;
        }

        public Class this[int index]
        {
            get
            {
                return (Class)base.List[index];
            }
            set
            {
                base.List[index] = value;
            }
        }
    }

    public class Class
    {
    }
}

 

posted @ 2015-10-02 22:18  LuciaKally  阅读(219)  评论(0编辑  收藏  举报