001_集合Collection

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections;
namespace ConsoleApp
{
    //集合
    class Collection:CollectionBase
    {
        public void Add(Object item ) {
            this.InnerList.Add(item);
        }
        public void Remove(Object item) {
            this.InnerList.Remove(item);
        }
        public void Clear() {
            this.InnerList.Clear();
        }
        public int Count() {
            return InnerList.Count;
        }
    }
}

調(diào)用集合:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp
{
    class example_01
    {
        static void Main()
        {
            Collection names = new Collection();
            names.Add("張三");
            names.Add("李四");
            names.Add("王五");
            names.Add("張武");

            foreach (Object name in names)
            {
                Console.WriteLine(name);
            }

            Console.WriteLine(names.Count());

            names.Remove("王五");
            Console.WriteLine("--------------------");
            foreach (Object name in names)
            {
                Console.WriteLine(name);
            }

            Console.WriteLine(names.Count());
            names.Clear();
            Console.WriteLine("--------------------");
            Console.WriteLine(names.Count());

            Console.Read();
        }
    }
}

運(yùn)行結(jié)果:
張三
李四
王五
張武
4


張三
李四
張武
3


0

#region 程序集 mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
// C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2\mscorlib.dll
#endregion

using System.Runtime.InteropServices;

namespace System.Collections
{
    //
    // 摘要:
    //     為強(qiáng)類型集合提供 abstract 基類。
    [ComVisible(true)]
    public abstract class CollectionBase : IList, ICollection, IEnumerable
    {
        //
        // 摘要:
        //     使用默認(rèn)初始容量初始化 System.Collections.CollectionBase 類的新實(shí)例。
        protected CollectionBase();
        //
        // 摘要:
        //     使用指定的容量初始化 System.Collections.CollectionBase 類的新實(shí)例。
        //
        // 參數(shù):
        //   capacity:
        //     新列表最初可以存儲(chǔ)的元素?cái)?shù)。
        protected CollectionBase(int capacity);

        //
        // 摘要:
        //     獲取或設(shè)置 System.Collections.CollectionBase 可包含的元素?cái)?shù)。
        //
        // 返回結(jié)果:
        //     System.Collections.CollectionBase 可包含的元素?cái)?shù)。
        //
        // 異常:
        //   T:System.ArgumentOutOfRangeException:
        //     System.Collections.CollectionBase.Capacity 設(shè)置為小于 System.Collections.CollectionBase.Count
        //     的值。
        //
        //   T:System.OutOfMemoryException:
        //     系統(tǒng)中沒有足夠的可用內(nèi)存。
        [ComVisible(false)]
        public int Capacity { get; set; }
        //
        // 摘要:
        //     獲取包含在 System.Collections.CollectionBase 實(shí)例中的元素?cái)?shù)。不能重寫此屬性。
        //
        // 返回結(jié)果:
        //     包含在 System.Collections.CollectionBase 實(shí)例中的元素?cái)?shù)。檢索此屬性的值的運(yùn)算復(fù)雜度為 O(1)。
        public int Count { get; }
        //
        // 摘要:
        //     獲取一個(gè) System.Collections.ArrayList,它包含 System.Collections.CollectionBase 實(shí)例中元素的列表。
        //
        // 返回結(jié)果:
        //     表示 System.Collections.CollectionBase 實(shí)例本身的 System.Collections.ArrayList。檢索此屬性的值的運(yùn)算復(fù)雜度為
        //     O(1)。
        protected ArrayList InnerList { get; }
        //
        // 摘要:
        //     獲取一個(gè) System.Collections.IList,它包含 System.Collections.CollectionBase 實(shí)例中元素的列表。
        //
        // 返回結(jié)果:
        //     表示 System.Collections.CollectionBase 實(shí)例本身的 System.Collections.IList。
        protected IList List { get; }

        //
        // 摘要:
        //     從 System.Collections.CollectionBase 實(shí)例移除所有對(duì)象。不能重寫此方法。
        public void Clear();
        //
        // 摘要:
        //     返回循環(huán)訪問(wèn) System.Collections.CollectionBase 實(shí)例的枚舉器。
        //
        // 返回結(jié)果:
        //     用于 System.Collections.CollectionBase 實(shí)例的 System.Collections.IEnumerator。
        public IEnumerator GetEnumerator();
        //
        // 摘要:
        //     移除 System.Collections.CollectionBase 實(shí)例的指定索引處的元素。此方法不可重寫。
        //
        // 參數(shù):
        //   index:
        //     要移除的元素的從零開始的索引。
        //
        // 異常:
        //   T:System.ArgumentOutOfRangeException:
        //     index 小于零。- 或 -index 等于或大于 System.Collections.CollectionBase.Count。
        public void RemoveAt(int index);
        //
        // 摘要:
        //     當(dāng)清除 System.Collections.CollectionBase 實(shí)例的內(nèi)容時(shí)執(zhí)行其他自定義進(jìn)程。
        protected virtual void OnClear();
        //
        // 摘要:
        //     在清除 System.Collections.CollectionBase 實(shí)例的內(nèi)容之后執(zhí)行其他自定義進(jìn)程。
        protected virtual void OnClearComplete();
        //
        // 摘要:
        //     在向 System.Collections.CollectionBase 實(shí)例中插入新元素之前執(zhí)行其他自定義進(jìn)程。
        //
        // 參數(shù):
        //   index:
        //     從零開始的索引,在該處插入 value。
        //
        //   value:
        //     index 處的元素的新值。
        protected virtual void OnInsert(int index, object value);
        //
        // 摘要:
        //     在向 System.Collections.CollectionBase 實(shí)例中插入新元素之后執(zhí)行其他自定義進(jìn)程。
        //
        // 參數(shù):
        //   index:
        //     從零開始的索引,在該處插入 value。
        //
        //   value:
        //     index 處的元素的新值。
        protected virtual void OnInsertComplete(int index, object value);
        //
        // 摘要:
        //     當(dāng)從 System.Collections.CollectionBase 實(shí)例移除元素時(shí)執(zhí)行其他自定義進(jìn)程。
        //
        // 參數(shù):
        //   index:
        //     從零開始的索引,可在該位置找到 value。
        //
        //   value:
        //     要從 index 移除的元素的值。
        protected virtual void OnRemove(int index, object value);
        //
        // 摘要:
        //     在從 System.Collections.CollectionBase 實(shí)例中移除元素之后執(zhí)行其他自定義進(jìn)程。
        //
        // 參數(shù):
        //   index:
        //     從零開始的索引,可在該位置找到 value。
        //
        //   value:
        //     要從 index 移除的元素的值。
        protected virtual void OnRemoveComplete(int index, object value);
        //
        // 摘要:
        //     當(dāng)在 System.Collections.CollectionBase 實(shí)例中設(shè)置值之前執(zhí)行其他自定義進(jìn)程。
        //
        // 參數(shù):
        //   index:
        //     從零開始的索引,可在該位置找到 oldValue。
        //
        //   oldValue:
        //     要用 newValue 替換的值。
        //
        //   newValue:
        //     index 處的元素的新值。
        protected virtual void OnSet(int index, object oldValue, object newValue);
        //
        // 摘要:
        //     當(dāng)在 System.Collections.CollectionBase 實(shí)例中設(shè)置值后執(zhí)行其他自定義進(jìn)程。
        //
        // 參數(shù):
        //   index:
        //     從零開始的索引,可在該位置找到 oldValue。
        //
        //   oldValue:
        //     要用 newValue 替換的值。
        //
        //   newValue:
        //     index 處的元素的新值。
        protected virtual void OnSetComplete(int index, object oldValue, object newValue);
        //
        // 摘要:
        //     當(dāng)驗(yàn)證值時(shí)執(zhí)行其他自定義進(jìn)程。
        //
        // 參數(shù):
        //   value:
        //     要驗(yàn)證的對(duì)象。
        //
        // 異常:
        //   T:System.ArgumentNullException:
        //     value 為 null。
        protected virtual void OnValidate(object value);
    }
}
#region 程序集 mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
// C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2\mscorlib.dll
#endregion

using System.Diagnostics;
using System.Reflection;
using System.Runtime;
using System.Runtime.InteropServices;
using System.Security;

namespace System.Collections
{
    //
    // 摘要:
    //     使用大小會(huì)根據(jù)需要?jiǎng)討B(tài)增加的數(shù)組來(lái)實(shí)現(xiàn) System.Collections.IList 接口。
    [ComVisible(true)]
    [DebuggerDisplay("Count = {Count}")]
    [DebuggerTypeProxy(typeof(ArrayListDebugView))]
    [DefaultMember("Item")]
    public class ArrayList : IList, ICollection, IEnumerable, ICloneable
    {
        //
        // 摘要:
        //     初始化 System.Collections.ArrayList 類的新實(shí)例,該實(shí)例為空并且具有默認(rèn)初始容量。
        [TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
        public ArrayList();
        //
        // 摘要:
        //     初始化 System.Collections.ArrayList 類的新實(shí)例,該實(shí)例為空并且具有指定的初始容量。
        //
        // 參數(shù):
        //   capacity:
        //     新列表最初可以存儲(chǔ)的元素?cái)?shù)。
        //
        // 異常:
        //   T:System.ArgumentOutOfRangeException:
        //     capacity 小于零。
        public ArrayList(int capacity);
        //
        // 摘要:
        //     初始化 System.Collections.ArrayList 類的新實(shí)例,該實(shí)例包含從指定集合復(fù)制的元素并且具有與所復(fù)制的元素?cái)?shù)相同的初始容量。
        //
        // 參數(shù):
        //   c:
        //     System.Collections.ICollection,它的元素被復(fù)制到新列表中。
        //
        // 異常:
        //   T:System.ArgumentNullException:
        //     c 為 null。
        public ArrayList(ICollection c);

        //
        // 摘要:
        //     獲取或設(shè)置位于指定索引處的元素。
        //
        // 參數(shù):
        //   index:
        //     要獲得或設(shè)置的元素從零開始的索引。
        //
        // 返回結(jié)果:
        //     位于指定索引處的元素。
        //
        // 異常:
        //   T:System.ArgumentOutOfRangeException:
        //     index 小于零。- 或 -index 等于或大于 System.Collections.ArrayList.Count。
        public virtual object this[int index] { get; set; }

        //
        // 摘要:
        //     獲取或設(shè)置 System.Collections.ArrayList 可包含的元素?cái)?shù)。
        //
        // 返回結(jié)果:
        //     System.Collections.ArrayList 可包含的元素?cái)?shù)。
        //
        // 異常:
        //   T:System.ArgumentOutOfRangeException:
        //     System.Collections.ArrayList.Capacity 設(shè)置為小于 System.Collections.ArrayList.Count
        //     的值。
        //
        //   T:System.OutOfMemoryException:
        //     系統(tǒng)中沒有足夠的可用內(nèi)存。
        public virtual int Capacity { get; set; }
        //
        // 摘要:
        //     獲取 System.Collections.ArrayList 中實(shí)際包含的元素?cái)?shù)。
        //
        // 返回結(jié)果:
        //     System.Collections.ArrayList 中實(shí)際包含的元素?cái)?shù)。
        public virtual int Count { get; }
        //
        // 摘要:
        //     獲取一個(gè)值,該值指示 System.Collections.ArrayList 是否具有固定大小。
        //
        // 返回結(jié)果:
        //     如果 System.Collections.ArrayList 具有固定大小,則為 true;否則為 false。默認(rèn)值為 false。
        public virtual bool IsFixedSize { get; }
        //
        // 摘要:
        //     獲取一個(gè)值,該值指示 System.Collections.ArrayList 是否為只讀。
        //
        // 返回結(jié)果:
        //     如果 System.Collections.ArrayList 為只讀,則為 true;否則為 false。默認(rèn)值為 false。
        public virtual bool IsReadOnly { get; }
        //
        // 摘要:
        //     獲取一個(gè)值,該值指示是否同步對(duì) System.Collections.ArrayList 的訪問(wèn)(線程安全)。
        //
        // 返回結(jié)果:
        //     如果對(duì) System.Collections.ArrayList 的訪問(wèn)是同步的(線程安全),則為 true;否則為 false。默認(rèn)值為 false。
        public virtual bool IsSynchronized { get; }
        //
        // 摘要:
        //     獲取可用于同步對(duì) System.Collections.ArrayList 的訪問(wèn)的對(duì)象。
        //
        // 返回結(jié)果:
        //     可用于同步對(duì) System.Collections.ArrayList 的訪問(wèn)的對(duì)象。
        public virtual object SyncRoot { get; }

        //
        // 摘要:
        //     為特定的 System.Collections.IList 創(chuàng)建 System.Collections.ArrayList 包裝。
        //
        // 參數(shù):
        //   list:
        //     要包裝的 System.Collections.IList。
        //
        // 返回結(jié)果:
        //     System.Collections.IList 周圍的 System.Collections.ArrayList 包裝。
        //
        // 異常:
        //   T:System.ArgumentNullException:
        //     list 為 null。
        public static ArrayList Adapter(IList list);
        //
        // 摘要:
        //     返回具有固定大小的 System.Collections.IList 包裝。
        //
        // 參數(shù):
        //   list:
        //     要包裝的 System.Collections.IList。
        //
        // 返回結(jié)果:
        //     具有固定大小的 System.Collections.IList 包裝。
        //
        // 異常:
        //   T:System.ArgumentNullException:
        //     list 為 null。
        public static IList FixedSize(IList list);
        //
        // 摘要:
        //     返回具有固定大小的 System.Collections.ArrayList 包裝。
        //
        // 參數(shù):
        //   list:
        //     要包裝的 System.Collections.ArrayList。
        //
        // 返回結(jié)果:
        //     具有固定大小的 System.Collections.ArrayList 包裝。
        //
        // 異常:
        //   T:System.ArgumentNullException:
        //     list 為 null。
        public static ArrayList FixedSize(ArrayList list);
        //
        // 摘要:
        //     返回只讀的 System.Collections.IList 包裝。
        //
        // 參數(shù):
        //   list:
        //     要包裝的 System.Collections.IList。
        //
        // 返回結(jié)果:
        //     list 周圍的只讀 System.Collections.IList 包裝。
        //
        // 異常:
        //   T:System.ArgumentNullException:
        //     list 為 null。
        public static IList ReadOnly(IList list);
        //
        // 摘要:
        //     返回只讀的 System.Collections.ArrayList 包裝。
        //
        // 參數(shù):
        //   list:
        //     要包裝的 System.Collections.ArrayList。
        //
        // 返回結(jié)果:
        //     list 周圍的只讀 System.Collections.ArrayList 包裝。
        //
        // 異常:
        //   T:System.ArgumentNullException:
        //     list 為 null。
        public static ArrayList ReadOnly(ArrayList list);
        //
        // 摘要:
        //     返回 System.Collections.ArrayList,它的元素是指定值的副本。
        //
        // 參數(shù):
        //   value:
        //     要在新 System.Collections.ArrayList 中對(duì)其進(jìn)行多次復(fù)制的 System.Object。該值可以為 null。
        //
        //   count:
        //     value 應(yīng)被復(fù)制的次數(shù)。
        //
        // 返回結(jié)果:
        //     具有 count 所指定的元素?cái)?shù)的 System.Collections.ArrayList,其中的所有元素都是 value 的副本。
        //
        // 異常:
        //   T:System.ArgumentOutOfRangeException:
        //     count 小于零。
        public static ArrayList Repeat(object value, int count);
        //
        // 摘要:
        //     返回同步的(線程安全)System.Collections.ArrayList 包裝。
        //
        // 參數(shù):
        //   list:
        //     要同步的 System.Collections.ArrayList。
        //
        // 返回結(jié)果:
        //     同步的(線程安全)System.Collections.ArrayList 包裝。
        //
        // 異常:
        //   T:System.ArgumentNullException:
        //     list 為 null。
        public static ArrayList Synchronized(ArrayList list);
        //
        // 摘要:
        //     返回同步的(線程安全)System.Collections.IList 包裝。
        //
        // 參數(shù):
        //   list:
        //     要同步的 System.Collections.IList。
        //
        // 返回結(jié)果:
        //     同步的(線程安全)System.Collections.IList 包裝。
        //
        // 異常:
        //   T:System.ArgumentNullException:
        //     list 為 null。
        public static IList Synchronized(IList list);
        //
        // 摘要:
        //     將對(duì)象添加到 System.Collections.ArrayList 的結(jié)尾處。
        //
        // 參數(shù):
        //   value:
        //     要添加到 System.Collections.ArrayList 的末尾處的 System.Object。該值可以為 null。
        //
        // 返回結(jié)果:
        //     System.Collections.ArrayList 索引,已在此處添加了 value。
        //
        // 異常:
        //   T:System.NotSupportedException:
        //     System.Collections.ArrayList 為只讀。- 或 -System.Collections.ArrayList 具有固定大小。
        public virtual int Add(object value);
        //
        // 摘要:
        //     將 System.Collections.ICollection 的元素添加到 System.Collections.ArrayList 的末尾。
        //
        // 參數(shù):
        //   c:
        //     System.Collections.ICollection,其元素應(yīng)被添加到 System.Collections.ArrayList 的末尾。集合本身不能為
        //     null,但它可以包含為 null 的元素。
        //
        // 異常:
        //   T:System.ArgumentNullException:
        //     c 為 null。
        //
        //   T:System.NotSupportedException:
        //     System.Collections.ArrayList 為只讀。- 或 -System.Collections.ArrayList 具有固定大小。
        [TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
        public virtual void AddRange(ICollection c);
        //
        // 摘要:
        //     使用默認(rèn)的比較器在整個(gè)已排序的 System.Collections.ArrayList 中搜索元素,并返回該元素從零開始的索引。
        //
        // 參數(shù):
        //   value:
        //     要定位的 System.Object。該值可以為 null。
        //
        // 返回結(jié)果:
        //     如果找到 value,則為已排序的 System.Collections.ArrayList 中從零開始的 value 索引;否則為一個(gè)負(fù)數(shù),它是大于 value
        //     的下一個(gè)元素索引的按位求補(bǔ),如果沒有更大的元素,則為 System.Collections.ArrayList.Count 的按位求補(bǔ)。
        //
        // 異常:
        //   T:System.ArgumentException:
        //     無(wú)論是 value 還是 System.Collections.ArrayList 的元素都不實(shí)現(xiàn) System.IComparable 接口。
        //
        //   T:System.InvalidOperationException:
        //     value 與 System.Collections.ArrayList 的元素類型不同。
        public virtual int BinarySearch(object value);
        //
        // 摘要:
        //     使用指定的比較器在整個(gè)已排序的 System.Collections.ArrayList 中搜索元素,并返回該元素從零開始的索引。
        //
        // 參數(shù):
        //   value:
        //     要定位的 System.Object。該值可以為 null。
        //
        //   comparer:
        //     比較元素時(shí)要使用的 System.Collections.IComparer 實(shí)現(xiàn)。- 或 -null 表示使用默認(rèn)比較器,即每個(gè)元素的 System.IComparable
        //     實(shí)現(xiàn)。
        //
        // 返回結(jié)果:
        //     如果找到 value,則為已排序的 System.Collections.ArrayList 中從零開始的 value 索引;否則為一個(gè)負(fù)數(shù),它是大于 value
        //     的下一個(gè)元素索引的按位求補(bǔ),如果沒有更大的元素,則為 System.Collections.ArrayList.Count 的按位求補(bǔ)。
        //
        // 異常:
        //   T:System.ArgumentException:
        //     comparer 為 null,而且 value 和 System.Collections.ArrayList 的元素都不實(shí)現(xiàn) System.IComparable
        //     接口。
        //
        //   T:System.InvalidOperationException:
        //     comparer 為 null,而且 value 與 System.Collections.ArrayList 的元素不屬于同一類型。
        public virtual int BinarySearch(object value, IComparer comparer);
        //
        // 摘要:
        //     使用指定的比較器在已排序 System.Collections.ArrayList 的某個(gè)元素范圍中搜索元素,并返回該元素從零開始的索引。
        //
        // 參數(shù):
        //   index:
        //     要搜索的范圍從零開始的起始索引。
        //
        //   count:
        //     要搜索的范圍的長(zhǎng)度。
        //
        //   value:
        //     要定位的 System.Object。該值可以為 null。
        //
        //   comparer:
        //     比較元素時(shí)要使用的 System.Collections.IComparer 實(shí)現(xiàn)。- 或 -null 表示使用默認(rèn)比較器,即每個(gè)元素的 System.IComparable
        //     實(shí)現(xiàn)。
        //
        // 返回結(jié)果:
        //     如果找到 value,則為已排序的 System.Collections.ArrayList 中從零開始的 value 索引;否則為一個(gè)負(fù)數(shù),它是大于 value
        //     的下一個(gè)元素索引的按位求補(bǔ),如果沒有更大的元素,則為 System.Collections.ArrayList.Count 的按位求補(bǔ)。
        //
        // 異常:
        //   T:System.ArgumentException:
        //     index 和 count 不表示 System.Collections.ArrayList 中的有效范圍。- 或 -comparer 為 null,而且
        //     value 和 System.Collections.ArrayList 的元素都不實(shí)現(xiàn) System.IComparable 接口。
        //
        //   T:System.InvalidOperationException:
        //     comparer 為 null,而且 value 與 System.Collections.ArrayList 的元素不屬于同一類型。
        //
        //   T:System.ArgumentOutOfRangeException:
        //     index 小于零。- 或 -count 小于零。
        public virtual int BinarySearch(int index, int count, object value, IComparer comparer);
        //
        // 摘要:
        //     從 System.Collections.ArrayList 中移除所有元素。
        //
        // 異常:
        //   T:System.NotSupportedException:
        //     System.Collections.ArrayList 為只讀。- 或 -System.Collections.ArrayList 具有固定大小。
        public virtual void Clear();
        //
        // 摘要:
        //     創(chuàng)建 System.Collections.ArrayList 的淺表副本。
        //
        // 返回結(jié)果:
        //     System.Collections.ArrayList 的淺表副本。
        public virtual object Clone();
        //
        // 摘要:
        //     確定某元素是否在 System.Collections.ArrayList 中。
        //
        // 參數(shù):
        //   item:
        //     要在 System.Collections.ArrayList 中查找的 System.Object。該值可以為 null。
        //
        // 返回結(jié)果:
        //     如果在 System.Collections.ArrayList 中找到 item,則為 true;否則為 false。
        public virtual bool Contains(object item);
        //
        // 摘要:
        //     從目標(biāo)數(shù)組的開頭開始將整個(gè) System.Collections.ArrayList 復(fù)制到兼容的一維 System.Array 中。
        //
        // 參數(shù):
        //   array:
        //     作為從 System.Collections.ArrayList 復(fù)制的元素的目標(biāo)的一維 System.Array。System.Array 必須具有從零開始的索引。
        //
        // 異常:
        //   T:System.ArgumentNullException:
        //     array 為 null。
        //
        //   T:System.ArgumentException:
        //     array 是多維的。- 或 -源 System.Collections.ArrayList 中的元素?cái)?shù)大于目標(biāo) array 可包含的元素?cái)?shù)。
        //
        //   T:System.InvalidCastException:
        //     源 System.Collections.ArrayList 的類型無(wú)法自動(dòng)轉(zhuǎn)換為目標(biāo) array 的類型。
        public virtual void CopyTo(Array array);
        //
        // 摘要:
        //     從目標(biāo)數(shù)組的指定索引處開始將整個(gè) System.Collections.ArrayList 復(fù)制到兼容的一維 System.Array。
        //
        // 參數(shù):
        //   array:
        //     作為從 System.Collections.ArrayList 復(fù)制的元素的目標(biāo)的一維 System.Array。System.Array 必須具有從零開始的索引。
        //
        //   arrayIndex:
        //     array 中從零開始的索引,從此索引處開始進(jìn)行復(fù)制。
        //
        // 異常:
        //   T:System.ArgumentNullException:
        //     array 為 null。
        //
        //   T:System.ArgumentOutOfRangeException:
        //     arrayIndex 小于零。
        //
        //   T:System.ArgumentException:
        //     array 是多維的。- 或 -源 System.Collections.ArrayList 中的元素?cái)?shù)目大于從 arrayIndex 到目標(biāo) array
        //     末尾之間的可用空間。
        //
        //   T:System.InvalidCastException:
        //     源 System.Collections.ArrayList 的類型無(wú)法自動(dòng)轉(zhuǎn)換為目標(biāo) array 的類型。
        public virtual void CopyTo(Array array, int arrayIndex);
        //
        // 摘要:
        //     從目標(biāo)數(shù)組的指定索引處開始,將一定范圍的元素從 System.Collections.ArrayList 復(fù)制到兼容的一維 System.Array 中。
        //
        // 參數(shù):
        //   index:
        //     源 System.Collections.ArrayList 中復(fù)制開始位置的從零開始的索引。
        //
        //   array:
        //     作為從 System.Collections.ArrayList 復(fù)制的元素的目標(biāo)的一維 System.Array。System.Array 必須具有從零開始的索引。
        //
        //   arrayIndex:
        //     array 中從零開始的索引,從此索引處開始進(jìn)行復(fù)制。
        //
        //   count:
        //     要復(fù)制的元素?cái)?shù)。
        //
        // 異常:
        //   T:System.ArgumentNullException:
        //     array 為 null。
        //
        //   T:System.ArgumentOutOfRangeException:
        //     index 小于零。- 或 -arrayIndex 小于零。- 或 -count 小于零。
        //
        //   T:System.ArgumentException:
        //     array 是多維的。- 或 -index 等于或大于源 System.Collections.ArrayList 的 System.Collections.ArrayList.Count。-
        //     或 -從 index 到源 System.Collections.ArrayList 的末尾的元素?cái)?shù)大于從 arrayIndex 到目標(biāo) array 的末尾的可用空間。
        //
        //   T:System.InvalidCastException:
        //     源 System.Collections.ArrayList 的類型無(wú)法自動(dòng)轉(zhuǎn)換為目標(biāo) array 的類型。
        public virtual void CopyTo(int index, Array array, int arrayIndex, int count);
        //
        // 摘要:
        //     返回整個(gè) System.Collections.ArrayList 的一個(gè)枚舉器。
        //
        // 返回結(jié)果:
        //     用于整個(gè) System.Collections.ArrayList 的 System.Collections.IEnumerator。
        [TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
        public virtual IEnumerator GetEnumerator();
        //
        // 摘要:
        //     返回 System.Collections.ArrayList 中某個(gè)范圍內(nèi)的元素的枚舉器。
        //
        // 參數(shù):
        //   index:
        //     枚舉器應(yīng)引用的 System.Collections.ArrayList 部分從零開始的起始索引。
        //
        //   count:
        //     枚舉器應(yīng)引用的 System.Collections.ArrayList 部分中的元素?cái)?shù)。
        //
        // 返回結(jié)果:
        //     System.Collections.ArrayList 中指定范圍內(nèi)的元素的 System.Collections.IEnumerator。
        //
        // 異常:
        //   T:System.ArgumentOutOfRangeException:
        //     index 小于零。- 或 -count 小于零。
        //
        //   T:System.ArgumentException:
        //     index 和 count 未指定 System.Collections.ArrayList 中的有效范圍。
        [TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
        public virtual IEnumerator GetEnumerator(int index, int count);
        //
        // 摘要:
        //     返回 System.Collections.ArrayList,它表示源 System.Collections.ArrayList 中元素的子集。
        //
        // 參數(shù):
        //   index:
        //     范圍開始處的從零開始的 System.Collections.ArrayList 索引。
        //
        //   count:
        //     范圍中的元素?cái)?shù)。
        //
        // 返回結(jié)果:
        //     System.Collections.ArrayList,它表示源 System.Collections.ArrayList 中元素的子集。
        //
        // 異常:
        //   T:System.ArgumentOutOfRangeException:
        //     index 小于零。- 或 -count 小于零。
        //
        //   T:System.ArgumentException:
        //     index 和 count 不表示 System.Collections.ArrayList 中元素的有效范圍。
        public virtual ArrayList GetRange(int index, int count);
        //
        // 摘要:
        //     搜索指定的 System.Object,并返回整個(gè) System.Collections.ArrayList 中第一個(gè)匹配項(xiàng)的從零開始的索引。
        //
        // 參數(shù):
        //   value:
        //     要在 System.Collections.ArrayList 中查找的 System.Object。該值可以為 null。
        //
        // 返回結(jié)果:
        //     如果在整個(gè) System.Collections.ArrayList 中找到 value 的第一個(gè)匹配項(xiàng),則為該項(xiàng)的從零開始的索引;否則為 -1。
        [TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
        public virtual int IndexOf(object value);
        //
        // 摘要:
        //     搜索指定的 System.Object,并返回 System.Collections.ArrayList 中從指定索引到最后一個(gè)元素的元素范圍內(nèi)第一個(gè)匹配項(xiàng)的從零開始的索引。
        //
        // 參數(shù):
        //   value:
        //     要在 System.Collections.ArrayList 中查找的 System.Object。該值可以為 null。
        //
        //   startIndex:
        //     從零開始的搜索的起始索引。空列表中 0(零)為有效值。
        //
        // 返回結(jié)果:
        //     如果在 System.Collections.ArrayList 中從 startIndex 到最后一個(gè)元素的元素范圍內(nèi)找到 value 的第一個(gè)匹配項(xiàng),則為該項(xiàng)的從零開始的索引;否則為
        //     -1。
        //
        // 異常:
        //   T:System.ArgumentOutOfRangeException:
        //     startIndex 不在 System.Collections.ArrayList 的有效索引范圍內(nèi)。
        public virtual int IndexOf(object value, int startIndex);
        //
        // 摘要:
        //     搜索指定的 System.Object,并返回 System.Collections.ArrayList 中從指定的索引開始并包含指定的元素?cái)?shù)的元素范圍內(nèi)第一個(gè)匹配項(xiàng)的從零開始的索引。
        //
        // 參數(shù):
        //   value:
        //     要在 System.Collections.ArrayList 中查找的 System.Object。該值可以為 null。
        //
        //   startIndex:
        //     從零開始的搜索的起始索引??樟斜碇?0(零)為有效值。
        //
        //   count:
        //     要搜索的部分中的元素?cái)?shù)。
        //
        // 返回結(jié)果:
        //     如果在 System.Collections.ArrayList 中從 startIndex 開始并包含 count 個(gè)元素的元素范圍內(nèi)找到 value
        //     的第一個(gè)匹配項(xiàng),則為該項(xiàng)的從零開始的索引;否則為 -1。
        //
        // 異常:
        //   T:System.ArgumentOutOfRangeException:
        //     startIndex 不在 System.Collections.ArrayList 的有效索引范圍內(nèi)。- 或 -count 小于零。- 或 -startIndex
        //     和 count 未指定 System.Collections.ArrayList 中的有效部分。
        public virtual int IndexOf(object value, int startIndex, int count);
        //
        // 摘要:
        //     將元素插入 System.Collections.ArrayList 的指定索引處。
        //
        // 參數(shù):
        //   index:
        //     從零開始的索引,應(yīng)在該位置插入 value。
        //
        //   value:
        //     要插入的 System.Object。該值可以為 null。
        //
        // 異常:
        //   T:System.ArgumentOutOfRangeException:
        //     index 小于零。- 或 -index 大于 System.Collections.ArrayList.Count。
        //
        //   T:System.NotSupportedException:
        //     System.Collections.ArrayList 為只讀。- 或 -System.Collections.ArrayList 具有固定大小。
        public virtual void Insert(int index, object value);
        //
        // 摘要:
        //     將集合中的某個(gè)元素插入 System.Collections.ArrayList 的指定索引處。
        //
        // 參數(shù):
        //   index:
        //     應(yīng)在此處插入新元素的從零開始的索引。
        //
        //   c:
        //     System.Collections.ICollection,應(yīng)將其元素插入到 System.Collections.ArrayList 中。集合本身不能為
        //     null,但它可以包含為 null 的元素。
        //
        // 異常:
        //   T:System.ArgumentNullException:
        //     c 為 null。
        //
        //   T:System.ArgumentOutOfRangeException:
        //     index 小于零。- 或 -index 大于 System.Collections.ArrayList.Count。
        //
        //   T:System.NotSupportedException:
        //     System.Collections.ArrayList 為只讀。- 或 -System.Collections.ArrayList 具有固定大小。
        public virtual void InsertRange(int index, ICollection c);
        //
        // 摘要:
        //     搜索指定的 System.Object,并返回整個(gè) System.Collections.ArrayList 中最后一個(gè)匹配項(xiàng)的從零開始的索引。
        //
        // 參數(shù):
        //   value:
        //     要在 System.Collections.ArrayList 中查找的 System.Object。該值可以為 null。
        //
        // 返回結(jié)果:
        //     如果在整個(gè) System.Collections.ArrayList 中找到 value 的最后一個(gè)匹配項(xiàng),則為該項(xiàng)的從零開始的索引;否則為 -1。
        public virtual int LastIndexOf(object value);
        //
        // 摘要:
        //     搜索指定的 System.Object,并返回 System.Collections.ArrayList 中從第一個(gè)元素到指定索引的元素范圍內(nèi)最后一個(gè)匹配項(xiàng)的從零開始的索引。
        //
        // 參數(shù):
        //   value:
        //     要在 System.Collections.ArrayList 中查找的 System.Object。該值可以為 null。
        //
        //   startIndex:
        //     向后搜索的從零開始的起始索引。
        //
        // 返回結(jié)果:
        //     如果在 System.Collections.ArrayList 中從第一個(gè)元素到 startIndex 的元素范圍內(nèi)找到 value 的最后一個(gè)匹配項(xiàng),則為該項(xiàng)的從零開始的索引;否則為
        //     -1。
        //
        // 異常:
        //   T:System.ArgumentOutOfRangeException:
        //     startIndex 不在 System.Collections.ArrayList 的有效索引范圍內(nèi)。
        public virtual int LastIndexOf(object value, int startIndex);
        //
        // 摘要:
        //     搜索指定的 System.Object,并返回 System.Collections.ArrayList 中包含指定的元素?cái)?shù)并在指定索引處結(jié)束的元素范圍內(nèi)最后一個(gè)匹配項(xiàng)的從零開始的索引。
        //
        // 參數(shù):
        //   value:
        //     要在 System.Collections.ArrayList 中查找的 System.Object。該值可以為 null。
        //
        //   startIndex:
        //     向后搜索的從零開始的起始索引。
        //
        //   count:
        //     要搜索的部分中的元素?cái)?shù)。
        //
        // 返回結(jié)果:
        //     如果在 System.Collections.ArrayList 中包含 count 個(gè)元素、在 startIndex 處結(jié)尾的元素范圍內(nèi)找到 value
        //     的最后一個(gè)匹配項(xiàng),則為該項(xiàng)的從零開始的索引;否則為 -1。
        //
        // 異常:
        //   T:System.ArgumentOutOfRangeException:
        //     startIndex 不在 System.Collections.ArrayList 的有效索引范圍內(nèi)。- 或 -count 小于零。- 或 -startIndex
        //     和 count 未指定 System.Collections.ArrayList 中的有效部分。
        public virtual int LastIndexOf(object value, int startIndex, int count);
        //
        // 摘要:
        //     從 System.Collections.ArrayList 中移除特定對(duì)象的第一個(gè)匹配項(xiàng)。
        //
        // 參數(shù):
        //   obj:
        //     要從 System.Collections.ArrayList 移除的 System.Object。該值可以為 null。
        //
        // 異常:
        //   T:System.NotSupportedException:
        //     System.Collections.ArrayList 為只讀。- 或 -System.Collections.ArrayList 具有固定大小。
        [TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
        public virtual void Remove(object obj);
        //
        // 摘要:
        //     移除 System.Collections.ArrayList 的指定索引處的元素。
        //
        // 參數(shù):
        //   index:
        //     要移除的元素的從零開始的索引。
        //
        // 異常:
        //   T:System.ArgumentOutOfRangeException:
        //     index 小于零。- 或 -index 等于或大于 System.Collections.ArrayList.Count。
        //
        //   T:System.NotSupportedException:
        //     System.Collections.ArrayList 為只讀。- 或 -System.Collections.ArrayList 具有固定大小。
        public virtual void RemoveAt(int index);
        //
        // 摘要:
        //     從 System.Collections.ArrayList 中移除一定范圍的元素。
        //
        // 參數(shù):
        //   index:
        //     要移除的元素的范圍從零開始的起始索引。
        //
        //   count:
        //     要移除的元素?cái)?shù)。
        //
        // 異常:
        //   T:System.ArgumentOutOfRangeException:
        //     index 小于零。- 或 -count 小于零。
        //
        //   T:System.ArgumentException:
        //     index 和 count 不表示 System.Collections.ArrayList 中元素的有效范圍。
        //
        //   T:System.NotSupportedException:
        //     System.Collections.ArrayList 為只讀。- 或 -System.Collections.ArrayList 具有固定大小。
        public virtual void RemoveRange(int index, int count);
        //
        // 摘要:
        //     將整個(gè) System.Collections.ArrayList 中元素的順序反轉(zhuǎn)。
        //
        // 異常:
        //   T:System.NotSupportedException:
        //     System.Collections.ArrayList 為只讀。
        public virtual void Reverse();
        //
        // 摘要:
        //     將指定范圍中元素的順序反轉(zhuǎn)。
        //
        // 參數(shù):
        //   index:
        //     要反轉(zhuǎn)的范圍的從零開始的起始索引。
        //
        //   count:
        //     要反轉(zhuǎn)的范圍內(nèi)的元素?cái)?shù)。
        //
        // 異常:
        //   T:System.ArgumentOutOfRangeException:
        //     index 小于零。- 或 -count 小于零。
        //
        //   T:System.ArgumentException:
        //     index 和 count 不表示 System.Collections.ArrayList 中元素的有效范圍。
        //
        //   T:System.NotSupportedException:
        //     System.Collections.ArrayList 為只讀。
        public virtual void Reverse(int index, int count);
        //
        // 摘要:
        //     將集合中的元素復(fù)制到 System.Collections.ArrayList 中一定范圍的元素上。
        //
        // 參數(shù):
        //   index:
        //     從零開始的 System.Collections.ArrayList 索引,從該位置開始復(fù)制 c 的元素。
        //
        //   c:
        //     System.Collections.ICollection,要將其元素復(fù)制到 System.Collections.ArrayList 中。集合本身不能為
        //     null,但它可以包含為 null 的元素。
        //
        // 異常:
        //   T:System.ArgumentOutOfRangeException:
        //     index 小于零。- 或 -index 加上 c 中的元素?cái)?shù)大于 System.Collections.ArrayList.Count。
        //
        //   T:System.ArgumentNullException:
        //     c 為 null。
        //
        //   T:System.NotSupportedException:
        //     System.Collections.ArrayList 為只讀。
        public virtual void SetRange(int index, ICollection c);
        //
        // 摘要:
        //     對(duì)整個(gè) System.Collections.ArrayList 中的元素進(jìn)行排序。
        //
        // 異常:
        //   T:System.NotSupportedException:
        //     System.Collections.ArrayList 為只讀。
        public virtual void Sort();
        //
        // 摘要:
        //     使用指定的比較器對(duì)整個(gè) System.Collections.ArrayList 中的元素進(jìn)行排序。
        //
        // 參數(shù):
        //   comparer:
        //     比較元素時(shí)要使用的 System.Collections.IComparer 實(shí)現(xiàn)。- 或 -null 引用(Visual Basic 中為 Nothing)將使用每個(gè)元數(shù)的
        //     System.IComparable 實(shí)現(xiàn)。
        //
        // 異常:
        //   T:System.NotSupportedException:
        //     System.Collections.ArrayList 為只讀。
        //
        //   T:System.InvalidOperationException:
        //     比較兩個(gè)元素時(shí)出錯(cuò)。
        public virtual void Sort(IComparer comparer);
        //
        // 摘要:
        //     使用指定的比較器對(duì) System.Collections.ArrayList 中某個(gè)范圍內(nèi)的元素進(jìn)行排序。
        //
        // 參數(shù):
        //   index:
        //     要排序的范圍的從零開始的起始索引。
        //
        //   count:
        //     要排序的范圍的長(zhǎng)度。
        //
        //   comparer:
        //     比較元素時(shí)要使用的 System.Collections.IComparer 實(shí)現(xiàn)。- 或 -null 引用(Visual Basic 中為 Nothing)將使用每個(gè)元數(shù)的
        //     System.IComparable 實(shí)現(xiàn)。
        //
        // 異常:
        //   T:System.ArgumentOutOfRangeException:
        //     index 小于零。- 或 -count 小于零。
        //
        //   T:System.ArgumentException:
        //     index 和 count 未指定 System.Collections.ArrayList 中的有效范圍。
        //
        //   T:System.NotSupportedException:
        //     System.Collections.ArrayList 為只讀。
        //
        //   T:System.InvalidOperationException:
        //     比較兩個(gè)元素時(shí)出錯(cuò)。
        public virtual void Sort(int index, int count, IComparer comparer);
        //
        // 摘要:
        //     將 System.Collections.ArrayList 的元素復(fù)制到新 System.Object 數(shù)組中。
        //
        // 返回結(jié)果:
        //     System.Object 數(shù)組,它包含 System.Collections.ArrayList 中元素的副本。
        public virtual object[] ToArray();
        //
        // 摘要:
        //     將 System.Collections.ArrayList 的元素復(fù)制到指定元素類型的新數(shù)組中。
        //
        // 參數(shù):
        //   type:
        //     要?jiǎng)?chuàng)建并向其復(fù)制元素的目標(biāo)數(shù)組的元素 System.Type。
        //
        // 返回結(jié)果:
        //     指定元素類型的數(shù)組,它包含 System.Collections.ArrayList 中元素的副本。
        //
        // 異常:
        //   T:System.ArgumentNullException:
        //     type 為 null。
        //
        //   T:System.InvalidCastException:
        //     源 System.Collections.ArrayList 的類型不能自動(dòng)轉(zhuǎn)換為指定類型。
        [SecuritySafeCritical]
        public virtual Array ToArray(Type type);
        //
        // 摘要:
        //     將容量設(shè)置為 System.Collections.ArrayList 中元素的實(shí)際數(shù)目。
        //
        // 異常:
        //   T:System.NotSupportedException:
        //     System.Collections.ArrayList 為只讀。- 或 -System.Collections.ArrayList 具有固定大小。
        public virtual void TrimToSize();
    }
}
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • 1. Java基礎(chǔ)部分 基礎(chǔ)部分的順序:基本語(yǔ)法,類相關(guān)的語(yǔ)法,內(nèi)部類的語(yǔ)法,繼承相關(guān)的語(yǔ)法,異常的語(yǔ)法,線程的語(yǔ)...
    子非魚_t_閱讀 34,853評(píng)論 18 399
  • 一. Java基礎(chǔ)部分.................................................
    wy_sure閱讀 4,036評(píng)論 0 11
  • 1 場(chǎng)景問(wèn)題# 1.1 復(fù)雜的獎(jiǎng)金計(jì)算## 考慮這樣一個(gè)實(shí)際應(yīng)用:就是如何實(shí)現(xiàn)靈活的獎(jiǎng)金計(jì)算。 獎(jiǎng)金計(jì)算是相對(duì)復(fù)雜...
    七寸知架構(gòu)閱讀 4,310評(píng)論 4 67
  • 總會(huì)偶那么一個(gè)時(shí)刻,心情低落到了極點(diǎn)。 實(shí)習(xí)結(jié)束,下班回學(xué)校的時(shí)候已經(jīng)晚上八點(diǎn)多了,我一邊等公交,一邊給小組開會(huì),...
    思恩的雜貨鋪閱讀 291評(píng)論 0 0
  • 我是個(gè)九零后,我的爸爸長(zhǎng)年在外打工,媽媽在家?guī)液偷艿?,我記得我是八歲那年徹底成為了留守兒童。那天我一早醒來(lái)不見了...
    普羅旺斯的約定閱讀 1,742評(píng)論 13 9

友情鏈接更多精彩內(nèi)容