国产精品天干天干,亚洲毛片在线,日韩gay小鲜肉啪啪18禁,女同Gay自慰喷水

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

C#編程-第二季-面向?qū)ο?宇宙最簡單2021最新版

2023-08-10 15:21 作者:霧隱半山  | 我要投稿

using System;


class MyList<T>

{

??private T[] items;

??private int count;


??public MyList()

??{

????items = new T[4];

????count = 0;

??}


??public int Capacity => items.Length;


??public int Count => count;


??public T this[int index]

??{

????get

????{

??????if (index < 0 || index >= count)

??????{

????????throw new IndexOutOfRangeException();

??????}

??????return items[index];

????}

????set

????{

??????if (index < 0 || index >= count)

??????{

????????throw new IndexOutOfRangeException();

??????}

??????items[index] = value;

????}

??}


??public void Add(T item)

??{

????if (count == items.Length)

????{

??????ResizeArray();

????}

????items[count] = item;

????count++;

??}


??public void Insert(int index, T item)

??{

????if (index < 0 || index > count)

????{

??????throw new IndexOutOfRangeException();

????}

????if (count == items.Length)

????{

??????ResizeArray();

????}

????for (int i = count; i > index; i--)

????{

??????items[i] = items[i - 1];

????}

????items[index] = item;

????count++;

??}


??public void RemoveAt(int index)

??{

????if (index < 0 || index >= count)

????{

??????throw new IndexOutOfRangeException();

????}

????for (int i = index; i < count - 1; i++)

????{

??????items[i] = items[i + 1];

????}

????count--;

????items[count] = default(T);

??}


??public int IndexOf(T item)

??{

????for (int i = 0; i < count; i++)

????{

??????if (items[i].Equals(item))

??????{

????????return i;

??????}

????}

????return -1;

??}


??public int LastIndexOf(T item)

??{

????for (int i = count - 1; i >= 0; i--)

????{

??????if (items[i].Equals(item))

??????{

????????return i;

??????}

????}

????return -1;

??}


??public void Sort()

??{

????Array.Sort(items, 0, count);

??}


??private void ResizeArray()

??{

????int newCapacity = items.Length * 2;

????T[] newArray = new T[newCapacity];

????Array.Copy(items, newArray, count);

????items = newArray;

??}

}


C#編程-第二季-面向?qū)ο?宇宙最簡單2021最新版的評論 (共 條)

分享到微博請遵守國家法律
张家港市| 鹤岗市| 宜黄县| 罗江县| 喜德县| 张家界市| 灌南县| 平潭县| 多伦县| 延庆县| 开封县| 土默特右旗| 漳浦县| 罗山县| 杨浦区| 安西县| 朝阳县| 西充县| 涞源县| 宝丰县| 台南市| 东平县| 永胜县| 仪征市| 新龙县| 临城县| 凤阳县| 天全县| 寻甸| 固镇县| 会东县| 盐亭县| 西藏| 常州市| 余干县| 双桥区| 河东区| 武定县| 温泉县| 柏乡县| 个旧市|