主要的内容:

<1>.原理性的东西----” 泛型的协变和逆变 “

  <2>.以及常用的接口----” IEnumerable 及其泛型版的IEnumerable<out T> “

<泛型的协变与逆变|泛型修饰符‘out’与‘in’>

先知道协变和逆变主要是用在泛型的接口和委托上就可以了,下面我们通过一个例子来看看:

我们知道接口是可以体现多态的,当然接口体现的多态注重的功能上的多态,这和抽象类不同,抽象类更注重的是建立在血缘关系上的多态。

知道接口是可以体现多态的之后,我们来看看一个相关的例子--

实例:鸟和飞机都会飞,把飞定义成一个接口,在定义2个类

public interface IFlyable
{
void fly();
}
class Bird:IFlyable
{
public void fly()
{
Console.WriteLine("鸟儿飞!");
}
}
class Plane:IFlyable
{
public void fly()
{
Console.WriteLine("飞机飞!");
}
}

下面看看接口体现的多态性:

            IFlyable ifly; 

            ifly = new Bird();
ifly.fly(); ifly = new Plane();
ifly.fly();

运行结果:

鸟儿飞!

飞机飞!

了解了接口的多态性后我们再来看一个例子:

这里定义了2个类 Animal 和 Cat (Cat继承了Animal)

  public class Animal
{
} public class Cat:Animal
{
}

继续往下看:

Cat cat = new Cat();

下面这句代码,cat向animal转,子类向父类转换,这时cat会隐式转换为animal 我们说“儿子像父亲” 这是完全可以理解的

Animal animal = cat;

但是 说”父亲像儿子“ 这是说不过去的 ,但是有的时候如果儿子坑爹,强制转换了一下还是可以的

cat = (Cat)animal;

(协变)

            List<Cat> catArray = new List<Cat>();
List<Animal> animalArray = catArray;

如果是上面说的类,这样写是可以的,但是这里是会报错的  如图

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAA18AAAA3CAIAAAB8a2eUAAAKqElEQVR4nO2d25GjOhRFJxKyQcGoyETlREwVcdhV5GE+nEPfDwQ6ko4ENva0fWftWh9tGoNebB89gD8/CCGEEEIILfrz2wlACCGEEEIfJKJDhBBCCCEURHSIEEIIIYSCiA4RQgghhFAQ0SFCCCGEEAr68/Pzc5vuAAAAAPCPQ3QIAAAAAAGiQwAAAAAIbEeHF2daN/qP11NrThf5x3S/TYN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IvoECGEEEIIBREdIoQQQgihIKJDhBBCCCEURHSIEEIIIYSCiA4RQgghhFAQ0SFCCCGEEAoiOkQIIYQQQkFEhwghhBBCKIjoECGEEEIIBREdIoQQQgihIKJDhBBCCCEU9B8gymuc0XeedgAAAABJRU5ErkJggg==" alt="" />

继续往下看 这样写却可以:

            IEnumerable<Cat> lCat = new List<Cat>();
IEnumerable<Animal> lAnimal = lCat;

对 IEnumerable<Cat> 转到定义 如图 我们发现这里多了一个 “out” 关键字

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgIAAABkCAIAAAB7Fc/1AAAKwElEQVR4nO2dTW7kthZGKyNPEyA9DzLNMpINBPBbQRaQPWQHWUIQ9DjwPh5eMn+L6CUwA7vVNO8PL/VDSuI5KBRU9CX5USrfT7qlsh8JAAAm5jFaAAAAjOTNBv77v//z4MGDB48JH8rVwMePH/taEQAADAMbAACYmvE28PhMz0nvRL7r/vzwYXmGCyEPHL8RsHB0kjyFDeQvf/j9r/yxffx9R2uatMNExd5TbeDPDx+WRwdJEaSkvEXq7yOm2K4G76shiZV2cIJHxtFzLTOu7ih1xsU/3rNOgxxwS2SrmLlsoHjezjJOZyfoMEv1UiB/uS55HZTyim25cZyAoKRg/F6zyzH7pOZllktcf1j5dEv3fcW0RmIDKRlr2zeH5qN1c4IOE0XeFtsT1qE2UP1pnzLXWBtw6HNB0HO6jWADR3ABG8hLOkXJSK32yEZnO4+Mj1noUSOrE0W6W9vOrpNYNaIkShxFWcYv1ARLOhFJTru0gUKe0+jolNuqBmtFakx1Lzk6LYbYQF6skLWUamXGKr9YNZDW4OoSpHgnsliRKsOS5MxitURW1LT2XbiADSQjjw9vlAHdur8Sf1vIZCS3qwGR7vGT92p6lcNW+0YKYlajTOXOTlg9kSXe4rjffHWKPOWpjTLA6Z4/q9M1za6+jI9pvWxakdXoOM0KScHIHbmGDSwt1XN89Yy+Z+Re3f21v9L6tpCJKZheZYuVNFtrOH56zefyw5xJ1VPy5KbpomNVQFP3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UyW+NHasEYHfuZgM//P5X/pAtr413Qt68n98d1JS2Vt9ZFL/z6oo83C9hAFydu9nAK0Wuz1+exwZ2UfIQX/LKn2VMZKhIvP99rvMkyl2UYANwb6azgfOwXZWaj+KNTQHV+HMmx+2q1u1PgAsxlw3kG3nJqGiUAWpBSTaqw8rIXca0MlFre/WnssqkFn/kxUTxZb2iUQaoBSV1IjlsXGfTmNaewRvgTsxiA056TZpPyMb82YpMIln7kY5sf0w/a+/4I6vUo14NOOk1aT4hG/Nnf3YnWVd1Bse0RrAaAS7KLDYg252MrzZKG7DcxZJUjYwbRjrsaiB4Tu2k12pGbrKB4OyqeF+ns23FV4MBrshcNmA1brwaiM+1ow2kwz4bWJccq/NuvBqIz4UNADQxnQ1EMn7SSkbxopAjpjppcMyFSDoO5qz46bwa3Jrxk1YyiheFLPHrdKpjWj/CA+Bm3M0GZK2maCkai+2UGYDskoQ9qJ83OB/8Op9PtI65IAvcweymDqVmWKe9iMmDre28r+xijSz1yOys/siJrI65/NR5WW0HODl3swGAI3hoFxNWDMC1wAYAAKYGGwAAmBpsAABgarABAICpwQYAAKZmpA1Y9+cBAEA3Bl8NYAMAAGPBBgAApgYbAACYGmwAAGBqxt8phBMAAAyEqwEAgKnBBgAApgYbAACYGmwAAGBq+BYxAMDUjL9TCAAABoINAABMjW4DC/0FAQBATyjNAwBMzb/1CmFBJd5PgwAAAABJRU5ErkJggg==" alt="" />

概念引入:

1.对于泛型类型参数,out 关键字指定该类型参数是协变的。 可以在泛型接口和委托中使用 out 关键字。“协变”是指能够使用与原始指定的派生类型相比,派生程度更大的类型。

--对于 “协变” 笔者是这样理解的就是”说的通变化“ 就像 “儿子像父亲一样”(假定父亲派生程度0那么儿子的派生程度就是1了,所以父亲可以使用派生程度更大的儿子)

协变与多态性类似,因此它看起来非常自然。

(逆变)

我们知道IComparable<T>接口中,T的修饰符是‘in’,下面我们修改一下上面的代码演示一下

   class Cat : Animal, IComparable<Cat>
{
//仅演示
public int CompareTo(Cat other)
{
return 1;
}
} class Animal : IComparable<Animal>
{
//仅演示
public int CompareTo(Animal other)
{
return 1;
}
}

这里Cat和Animal都实现了IComparable<T>接口,然后我们这样写

            IComparable<Cat> ICat = new Cat();
IComparable<Animal> IAnimal = new Animal();
ICat = IAnimal;

代码中ICat(高派生程度)使用 IAnimal(低派生程度) “父亲像儿子” 和上面的例子完全相反。

2.对于泛型类型参数,in 关键字指定该类型参数是逆变的。 可以在泛型接口和委托中使用 in 关键字。“逆变”则是指能够使用派生程度更小的类型。

--对于 “逆变” 笔者的理解则是 “坑爹儿子” 反过来硬说 “父亲像儿子” 这是 “说不过去的” 只是利用了强硬的手段

在了解了上面的内容后,我们来看看“out” 与 “in” 关键字的特性

IEnumerable<T>接口的IEnumerator<T> GetEnumerator()方法返回了一个迭代器 ,不难发现T如果用 out 标记,则T代表了输出,也就说只能作为结果返回。

下面我们演示一个例子

将动物会叫这功能,定义成一个泛型接口用 out 修饰

IComparable<T>接口的CompareTo(T other)方法传入了一个T类型的Other参数,不难发现T如果用 in 标记,则T代表了输入,也就是它只能作为参数传入。

IComparable<T>接口的CompareTo(T other)方法传入了一个T类型的Other参数,不难发现T如果用 in 标记,则T代表了输入,也就是它只能作为参数传入。

下面我们演示一个例子

将动物会叫这功能,定义成一个泛型借口用 out 修饰

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAASsAAAB5CAIAAADu95CrAAAGV0lEQVR4nO3dP27UTBjH8b1BuAHpkeAGG24AHaIh6SkQNRKhR0hwgnACcgNyBCo6pC3ShGZLCiRm3mL3dbzz97E948f2fj+yIu/EHs/a+9uZbBLPygLQs9JuAHDUSCCgiQQCmkggoIkEAppIIKCJBAKaiiVwtbKrUGW78ti3Bh5xHLH2l/Xoy3Wz1KjZL1/VfFarQyMccaZKnpHE6VU886VyXvUptBNSPIHBOnuHQbjfrv7214HHXSoSWHd3oRqpS9Q/JAaddg0eiBC2Zc5FM4Zsj8TS68Exm1OS2Cwxak3s3jyMtSfbAL+GTrv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35AAAAVJC5TsLfhfL0gQLApwW4DgAAwGeG5joAAAAAAACvBHAdAAAAAABeGeA6AAAAAAC8MsB1AAAAAAB4ZYDrAAAAAADwygDXAQAAAADglQGuAwAAAADAKwNcBwAAAACAV8a/dwvC7+Pc6LAAAAAASUVORK5CYII=" alt="" />

把第二个带参数的setSound方法,去掉后编译可以正常通过

下面我们把 out 改成 in

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAASgAAABsCAIAAABW27iAAAAHAElEQVR4nO2dPW8TSRiAl1CkjYEfEEF5ogCFFkXhBxCUSAghIUFKqiQVooloERKkoMYS/cnKH+AfsA0dUiKlCc35xJ0iHXfwXmFjm52PHdsz++56n0dRtDuenXl3dp/M6914nQkAVE6mHQBAG0E8AAUQD0ABxANQAPEAFEA8AAUQD0ABxANQAPEAFEA8AAWqFi/LJLP1OSh3vTRnj9Xgij8uv735ffSTomWzPPt1r2bex+xXrI23B4Xd9gy14lGIpXfSXZgUI7p41jYjijFoavJ39C4aBOLF6bqayFPI5mk/hRLWNlvoXpwdHiWKk+mWf9mamBVKPNU8qaln89GqK57SAMwWptrcFXzI7gywuldIPq3L5oK5+WS5KUPgePpxOdY29yImEpbl8ELrammdkINlPe9DmnK9GvInw7X5tANipWCIddlVaFaw1vRoEDie7s09LbfIvWaLN21gnt7982qpG66ozCzAUyd83pAAx+YpFN/U5FydR7xWWSeI52nW49K0haXizUBq8cT5fsy5OrN4bbNOKhMvMMGrJtX0L5fGGShPilRzBp2s6WXp5hPxWN7puVZnE6+F1klc8azJUma8/3blb2a5J9kLycrMzV3LhVA9HZUG7w/AFXzgHrlu4nkKC1sVSsxmPe5NO54mhZt40lbrJNGMBwB+4ugS+AcbWsu3b/L8udy/Ly9fyvfvw5I2gytQBWdnsrsrnz7J06fy6pV8+SJnZ9oxqYJ4MB/b29Lvl9Y6PZXzc/nxQz5/lkeP5MEDOT2tILj6gngwH8vL0ulIr6cdR8NAPJiP5eXh+/t790KmPhgQX7zC9WJYcEbiZ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yVpEbZ7KKS/KfDSgdOVT9EiduCep8tdM8AilbtAWqpGFL89JxnMVQM6n5O0oKYESLm3c9hlUxTB3crqn9cg8SVlnjipCPOjSCxDl4hwt5O6QkxkqKsQJTRebPW+Sr7tnIvGWxiVpkqqwfiZSGAqxJGIReXg0Jr2Tn7vW9Yv1oLrm5o2S7zjZ/b6F6II713oq1Ug+ttfW3HImnLtSJkep4tyK2sJNmUiDjU3NJ4yzDjzUoASWzIKsnvAKwVH3e1V/JZmOUlW25rp8dXfeNUva4vBK/KWc13131pXaIk1X6unsaRqTpTAIg4mfpxAF1aXFmOYSdyM4VsUT0IK2SA11cNu5svCVXMezqC3zrLgnXj8NVTZaLlW2scETCrKU9IAH8XVhSQzo/Warz7PYNGxpWNoPKc01Fz1i6gKj8fJRAjYUl7tS6crlJXxeb3xvdxid2nKvW21hT8pYT09jfNsSSNrvcm7SFmkw01thUz+/WbbQf6iYwa62pDctb9sFZ67NVCYj+fBe27vVuX5V8xZ152buclaHlw02WSRuO8sOXI3hainxLnmo86o7npWF0eCvbCNDvqpyUF7o8g3dedd0ob/zO3w1572/89t19AezCm3ssZ+Q1Ms9nfhwaqjinP4Gm4yb64r3y8KfhuYPPvDxR2FA3EzM8utVd6C4Wrv74TGJgT/4X/PxURY6J1MzD/LBzXZmrpUcRNT83wj8XII99zr41Mx8v4Vloi089Vl3bl7egj2tK+719wL32lpbHHj5nIvkBmZ3P9Dgrw7pX/m0y8fYGrOQt2Dgf5WB4A6EtgA30f1eThB8j6xri0D8j3UQ3EpoCxAEn5Ot2gIEQRAEQbCF0BYgCIIgCO5JaAsQBEEQBPcktAUIgiAIgnsS2gIEQRAEwT2Z1RYAAAAAAAB7AdoCAAAAAIA9AW0BAAAAAMCegLYAAAAAAGBPQFsAAAAAALAn/gM3tjpbNbH4AQAAAABJRU5ErkJggg==" alt="" />

把第一个setSound方法,去掉后编译可以正常通过,或者把第一个方法的返回值,改成其它非T类型,编译也可通过

这个演示充分说明了:

out 修饰 T 则 T只能作为结果输出而不能作为参数  ; in 修饰 T 则 T只能作为参数而不能作为结果返回;

<IEnumerable接口及其泛型版>

为什么要用IEnumerable接口? 下面我们通过一个例子看看:

 //定义Person类
public class Person
{
public Person(string _name)
{
this.name = _name;
} public string name;
} //定义People类
public class People
{
private Person[] _people; public People(Person[] pArray)
{
//实例化数组 用于存Person实例
_people = new Person[pArray.Length]; for (int i = 0; i < pArray.Length; i++)
{
_people[i] = pArray[i];
}
}
}

上面的代码我们定义了一个 Person 类和一个 People 类,显然 People是用来存放多个Person实例的集合,下面我们尝试用 Foreeach 遍历集合的每个元素 输出:

 static void Main(string[] args)
{
Person[] personArray = new Person[3]{
new Person("Keiling1"),
new Person("Keiling2"),
new Person("Keiling3"),
}; People people = new People(personArray);
foreach (Person item in people)
{
Console.WriteLine(item.name);
}
}

这里编译不能通过,出现了一个错误

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAzkAAAA7CAIAAADXUNPYAAAOkUlEQVR4nO2czZIb1RmG5wrwFbgvICYXgFmrK3ADjjfsCKlGG4qQRcgKwqpLC1fYkyK7UaHgPVVsZwrVAAsXJLYhjoHRmJnYRQCbMUZZ9N/5+c6PpJbUkp63npqa6Tndffr8vuc7Le1NEUIIIYRQV7W37gwghBBCCCGnfF5tb2+6t3IvN99N96pzLl37h0rLmVtMe6sqzdXXmkd7lSITLzs/CCGE0GbJOTXWk+Za7NrspzTnqBata3bN0O5YE7waQgghNJ/CXm31mvXWxgSPV+ug4p90d8oEIYQQipEwLxa7kDXiv4wjU2vvMvJ043b1EfuCvmeI82r2xmj9p3jcddB/riuHxj7gni5PYk9K6UaxFeTJZDBLc+RTPBKZEiGEENplzRBXMxyA+rttv+zfZzo40w6s7dVEp+X63XBaYkrXQTFBZD6DR1QbZPwM3cj8M7I8PXef+2DwT39KhBBCaMfVjlezU0ZG5sR52X9xKb0zrqYeDHo4I7Hrmn4DF59P1xE7OrW4V3P9y5Mff8Bsca/mieH5sogQQgjtmJbl1fzXXItX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ALAINz678/DhTy17teZ/e77/IoQQQgihZcvpxjBqCCGEEEJrF14NIYQQQqi7wqshhBBCCHVXeDWEEEIIoe7q/3uiz3QCeDbRAAAAAElFTkSuQmCC" alt="" />

GetEnumerator:是IEnumerable接口中的一个方法,它返回一个 IEnumerator(迭代器),如下图

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAawAAABiCAIAAACDP3CLAAAIFklEQVR4nO2dPW7cRhSAeQPpAonVp3BvGF7fwCoNuJDgIkAaq0qRxmrSpLJyAu0JvJVbbZMygIv03t5BtjASAwbiYQo5a2revMcZkksOd74PA4Eczs+bJflpZrkrVTUAQMFUUwcAADAlSBAAigYJAkDRIEEAKBokCABFgwQBoGiQIAAUDRIEgKJBggBQNEgQAIoGCQJA0SBBACgaJAgARbMXCVZVXYUavs3XDvXscRy0+Afku19XzSRzbjOnRQsjnwgBItnXDW2YYjRhDd71rvoIQ/A80tzNRDFGGJlECBADEhyvehKGBDMBCcJhkHBb7xazzSWhvR1cPHo5RjFj+WxU3+1q8bQGIFtIqq4FHzOcHZoEmxvNxbKXKQsEF6oyM9isUTK4+A3msEyGPEmb23i3dGpmcLe1TIw1gg6KaUo7GqNvrXrqCxJEs1VQWHXIkjKz+VMrWQv92W1q0bZWB8iEGUgwNTCjd3u+2eopLSo5OzbKRE4GW2eC2naSBDW3aiEFtWtEa3cEkANIMKrBmMxWCSYR855gfwnGdK21320mCJAbQ0owchE6znLY3m6NM1JkYy6H5badKWdt8cthIxiWw3BgJEvQeA4gN7QnA54u+zxGkNW1bS9Uo6PW4O0AtOAjRyQXj16Ol+lt1w39ySq1kGPk4w47KqOY1hFAJnSfCQIAHAAJVot/Ux8AYC6gNAAoGiQIAEWDBAGgaJAgABRNRwlWVVXxiAQA5k93CQ4bBwDAJCBBACgaJAgARYMEAaBourgMAwLAwcBMEACKBgkCQNEgQQAoGiQIAEXDN0YAoGgQGQAUDRIEgKJBggBQNEgQAIoGCQJA0eQiwep/pg7Ep0NIGY4CpiL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t0Pq3Fd/3Hrtzs/rqqqryj1/PlSzMFNmIMEY39WhxXL8ctiLKn762UeCdcpULlg41Xd1aLEcvxzWgu8WZ7BN7dAgBnSbjbu6cicnt/r7IsHlsn/LMGuml6BcpXo5Xqa3XTf0J6vUQo7B9xmNxx3G+5KpbWqvQNAvRr5XpllY227WlVW0lmU80k3BQ0bJ1jZ3R43d1nwPt1q509Om+75K8N27mBbggJlegtMGANkSnEhqZYK4zcZdXHhTP1+Cx8dusXAXF265dOv1oCOAeYAE4QBxy6V7/Nhwn6XFkxN3euouL91q5d6+nXoosHfuOGj870VX/AEF0nDpr5vfPj599vnouJv+tPTpwcOPT5/9/eNP29WbP3//Y/JhFpgOWYIk0oBpu3rz7zffDmtAmT4fHX968PCf73/48PMv29WbyUddQhpPggAHgLu+dkdH+1ahv4JeLFhBzxQkCAeI227d5eWYHvS1eP/+lzcW12u32Uz9eoBFmgS1DzQAZIjbbNzZ2YQqvKPF22fQV1duvXbb7dSvDXwl2WhIEOaFW6/dYjG5BH0n7lbQfDRnapAgFIG7vnb37vky2h3dbNzNjZ9ev3YvX/rpxQv36JFMQ66gVytW0GOCBKEg3OXlnWcm++5OivXmxr16FXDrkycBt56dufNzVtD7BglCWbjt9usbhQDdng7jQZg7brNxi8XUUUAWMBMEgKJBggBQNEgQAIoGCQJA0fCNEQAoGowGAEWDBAGgaJAgABQNEgSAokGCAFA0SBAAigYJAkDRIEEAKBokCABFgwQBoGj+A70vUfA6l3+BAAAAAElFTkSuQmCC" alt="" />

IEnumerator内部规定了,实现一个迭代器的所有基本方法,包括 如下图

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcoAAACUCAIAAACcDf64AAAN3ElEQVR4nO2d3W3byBaAiW0gBraAGNjHCySLve9RgC0gWaQAu4LNw75b7iC5acCuYLPbQJQOkg6cCpwOZu6DFJninHN4huTwx/w+CIY4mjlzhtJ8nqHopIoAAFCAauoEAAAeJ+gVAKAI6BUAoAjoFQCgCL30WlWxkgLsy7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4sHXd7cPBiTWw4ABgK9zpRwfx+22/DkSYsxj7p89epBl+/ePeiSr6cAJkK9hajQn3VCFpZkAWDedL+LCMYk3NyEp0/RK8CCQK9L4kSyADBv0OvyONzFBQDzBr0CABTB++9IAQBAFqxeAQCKgF4BAIqAXgEAioBeAQCKwF9tAQAUAYcCABQBvQIAFAG9AgAUAb0CABQBvQIAFOH/nDEkk5KLRFEAAAAASUVORK5CYII=" alt="" />

为了在foreach中使用 People的实例, 我们给People实现IEnumerable接口,代码如下:

 public class People:IEnumerable
{
private Person[] _people; public People(Person[] pArray)
{
//实例化数组 用于存Person实例
_people = new Person[pArray.Length]; for (int i = 0; i < pArray.Length; i++)
{
_people[i] = pArray[i];
}
}
////IEnumerable和IEnumerator通过IEnumerable的GetEnumerator()方法建立了连接,可以通过IEnumerable的GetEnumerator()得到IEnumerator对象。
IEnumerator IEnumerable.GetEnumerator()
{
return (IEnumerator)GetEnumerator();
} public PeopleEnum GetEnumerator()
{
return new PeopleEnum(_people);
}
} public class PeopleEnum:IEnumerator
{
public Person[] _people; public PeopleEnum(Person [] pArray)
{
_people = pArray;
}
//游标
int position = -1; //是否可以往下 移
public bool MoveNext()
{
position++;
return (position < _people.Length);
} //集合的所有元素取完了之后 重置position
public void Reset()
{
position = -1;
} //实现 IEnumerator的 Current方法 返回当前所指的Person对象
object IEnumerator.Current
{
get
{
return Current;
}
} //Current是返回Person类实例的只读方法
public Person Current
{
get
{
try
{
return _people[position];
}
catch (IndexOutOfRangeException)
{
throw new InvalidOperationException();
}
}
}
}

测试运行:   

static void Main(string[] args)
{
Person[] personArray = new Person[3]{
new Person("Keiling1"),
new Person("Keiling2"),
new Person("Keiling3"),
}; People people = new People(personArray);
foreach (Person item in people)
{
Console.WriteLine(item.name);
}
}

结果:

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAPIAAAA8CAIAAADT6HA3AAACV0lEQVR4nO3Z0W0rIRBGYcpOEykmHVBCakgjyUMUyd6BWSADZv8935OFuRhFx6zFTd+AnPTqDQDxyBqCyBqCyBqCyBqCyBqCyBqCyBqCyBqCyBqCjll/fb5/fb7nj7cE7IGsIYisIYisISgy6/znd+nH1z47Mz9omT8mZBFsKPi0jsp6bLxL1HcDG5qV9c7l+Y8CCFiUda2k3h8bxfn5WXF+bUv9fzFcwJSsnYCKMbVnXRyvre9/LlkLW3FaZ+OwCbJGrHVZO5sga8SalXXqSXxS1sk8KFoWh4DIrA/12Ne1tuy7XeOnXxtnM8QtKfi03kpL7pCknHXiivquxLPGPZE1BJE1BJE1BJE1BEVm7dxb+/z77Jb5vbgh0RZ8WkdlPTbeiPtsebOyDsllUnNkLW9R1rWHfu+PjeL8/Kw4v7habRBXNyXrYnb2dXHCwHht/eHPxdWtOK2zcdjES7KmaWHrsnY2sT5rmtY2K+vUk/ikrJN5UJzOh4bIrE/rsQ1lY2C8JdOWxSEj+LTeCqfybSlnnfjfxLsSzxr3RNYQRNYQRNYQRNYQFJm1c2/t8++zW+b34oZEW/BpHZX12Hgj7rPlzco6JJcFzZG1pEVZ1x76vT82ivPzs+L84mq1QVzdlKyL2dnXxQkD47X1/c91vk64uhWndTYOm3hJ1v44Lm1d1s4myBqxZmWdehKflHUyD4rT+dAQmfVpPbahbAyMt2Tq5P7/PyJ2E3xab4VT+baUs06cynclnjXuaVHW/mFp3z09XGs/oP1/Nbyy/1bvZoY3j0YDWf8AExqiEsjS4IEAAAAASUVORK5CYII=" alt="" />

总结:

1.一个集合要支持foreach方式的遍历,必须实现IEnumerable接口,描述这类实现了该接口的对象,我们叫它 ‘序列’。

比如 List<T> 支持 foreach 遍历 是因为它实现了IEnumerable接口和其泛型版,如图--

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAA6AAAACiCAIAAADQhzdwAAAgAElEQVR4nO29f1xU17nvP4kx1h/JNLWWNtaOr9jGpsY7TU2OWuyZ5iY51Kh3TpJruGrPnebyMur1eMaUGk2od9emLVWbTK3BaYo4rcIXLUl3QCKikUGJMkpgG5AOCm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VFxcDQF5enkajmT179oIFCzQaTWtra3d3d2ZmJs3DcZzD4dDr9VOmTKFbFy1aNHPmzP3791ODCQkJDlZ8CIIgCIIg440oFbizZ4PNBjYb9E0eADdviilU7wKAyyWm0A/D4wGPp581aTa2yW7vN4EusxZK3QJAXZ3fjtMJHo/4f1cX2O1gs8HNm/2sDUndUhobG6UzGHR0dNhsNpvN1to3I4OtD/YeWGNjI0ukKa2trTYJvb29ANDV1UW/UqHscDjYVvoPm6hBrVbbpAWKIAiCIAgyrohGgatQgELh75SdeGi1WoUEzQQOFUEQBEEQZMyJRoGLIAiCIAiCIMMGBS6CIAiCIAgyoUCBiyAIgiAIgkwoUOAiCIIgCIIgEwoUuAiCIAiCIMiEAgUugiAIgiAIMqFAgYsgCIIgCIJMKFDgIgiCIAiCIBMKFLgIgiAIgiDIhAIFLoIgCIIgCDKhQIGLIAiCIAiCTChQ4CIIgiAIgiATChS4CIIgCIIgyIQCBS6CIAiCIAgyoUCBiyAIgiAIgkwoUOAiCIIgCIIgEwoUuAiCIAiCIMiEAgUugiAIgiAIMqFAgYsgCIIgCIJMKFDgIgiCIAiCIBMKFLgIgiAIgiDIhAIFLoIgCIIgCDKhQIGLIAiCIAiCTCj+fxzmXN6UO5nxAAAAAElFTkSuQmCC" alt="" />

2. IEnumerator对象具体实现了迭代器(通过MoveNext(),Reset(),Current)。

3. 从这两个接口的用词选择上,也可以看出其不同:IEnumerable是一个声明式的接口,声明实现该接口的class是“可枚举(enumerable)”的,但并没有说明如何实现迭代器

而IEnumerator是一个实现式的接口,IEnumerator对象就是一个迭代器。

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcYAAAB8CAIAAAB8JofZAAASjUlEQVR4nO2dPazrthmGfbtkTFJ0b/YCRRKmgya3uIWnAzRRu2hSkwCehBb15skFLrwJaOO9cM7gzWgTT97cxZuBE2jyVE2aDNwDaNJkdqAkU+KPqWP6Rz7vg4MLmeLPJ5F8/X0knXQoAAAAS3SubQAAANwPkFQA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FYOnaNequq6kaSqlFpl0tGc5uJLz+alGvp6Gqk6qm6NJNWwdanxejs116r8RzMDcJRWDh2TtdTTJdWkaZP69SZp2rLoVZ0uNEfbPdFLNW8LkgpumVYOHZPQW58oLguYB/4aY442alhniYm0Gc5/czdTmrmpelLZsoB54K8y/mV2SutU3YKeglNo2egR4/FaSi2xdk05MRWLUEFqpeuzmk0nzXpu0zpLxAVBQ6WQViVVK016LQ+fWXXNlxWLqGoW7RGVTnpLk/NoneVdzcej6QDwYJQAcHwtQn8LgBKMEgAAsAYkFQAArAFJBQAAa0BSwQ3zxz/S//732kYA0ABIKrhh3r6lnQ793e8grKAtnFFSVWdWADDl3Tva6eR/EFbQBs4reZBUcBKPjwdJhbCCNgBJBTfM0xN986auqhBWcMNAUsFt88EHEkn96CP644/XtgwACZBUcNt88UVdT7/8kj4/X9ssAOScXfKgquAkvv22LqkI+cENAy8V3Db8pj/7e/v22jYBoASSCm6b1Yp2OvTrryvuKhxVcKtAUsFt8/xMv/46vy5VFY4quFUgqaA9PD9TQuCoglsGv54CraJUVTiq4CaB5IG28dNP9Oc/h6MKbhNIKmghTFXhqILbA5IK2snjI33zBo4quDUgqaC1PD7S3//+2kYAUAGSCgAA1oCkAgCANSCpAABgDUgqAABYA5IKAADWgKQCAIA1IKkAAGANSCoAAFgDkgoAANaApAIAgDX+D4AkLCrwD9vaAAAAAElFTkSuQmCC" alt="" />

4.由于IEnumerable<T>继承了IEnumerable接口,所以要实现IEnumerator<T> ,还需要实现IEnumerator接口,由于和泛型版本的方法同名,所以该方法的实现需要使用显式接口实现。

C#泛型(三)的更多相关文章

  1. Java 泛型 三

    一.泛型初衷 Java集合不会知道我们需要用它来保存什么类型的对象,所以他们把集合设计成能保存任何类型的对象,只要就具有很好的通用性.但这样做也带来两个问题: –集合对元素类型没有任何限制,这样可能引 ...

  2. 06.C#泛型约束和高级泛型(三章3.3-3.4)

    吃午饭前继上篇泛型再写一篇关于泛型的文章,虽然总是被博客园移出首页,文章不精确实是大问题啊,会再接再厉的.进入正题. 先来说下泛型约束.当我们在使用泛型的时候通常会希望使用泛型实参时,参数能具备某一些 ...

  3. Java泛型三:Java泛型详解

    原文地址https://www.cnblogs.com/lzq198754/p/5780426.html 1.为什么需要泛型 泛型在Java中有很重要的地位,网上很多文章罗列各种理论,不便于理解,本篇 ...

  4. java 面向对象(三十四):泛型三 自定义泛型类、泛型接口、泛型方法

    1.举例: [Order.java] public class Order<T> { String orderName; int orderId; //类的内部结构就可以使用类的泛型 T ...

  5. C#高级编程之泛型三(协变与逆变)

    为何引入协变.逆变 我们知道一个子类对象可以赋值给一个基类对象 Animal animal = new Animal(); Animal cat = new Cat(); 那如果是用在泛型里面能行嘛? ...

  6. java泛型中<?>和<T>有什么区别?

      public static void printColl(ArrayList<?> al){                Iterator<?> it = al.iter ...

  7. java泛型中<?>和<T>区别

    public static void printColl(ArrayList<?> al){                Iterator<?> it = al.iterat ...

  8. Java中泛型区别以及泛型擦除详解

    一.引言 复习javac的编译过程中的解语法糖的时候看见了泛型擦除中的举例,网上的资料大多比较散各针对性不一,在此做出自己的一些详细且易懂的总结. 二.泛型简介 泛型是JDK 1.5的一项新特性,一种 ...

  9. Java泛型和反射总结

    A a = (A)Class.forName(“pacage.A”).newInstance(); 这和你 A a = new A(): 是一样的效果. String className = “Exa ...

  10. java 泛型?和T的区别

    泛型三种:          [1]ArrayList<T> al=new ArrayList<T>();指定集合元素只能是T类型          [2]ArrayList& ...

随机推荐

  1. Scala学习之: Hello Word!

    scala 是一门纯粹的面向对象的语言 , 结合了python和java的优点. 它和java的集合度很高,是一个在JVM上运行的非java语言(PS 其实scala也是用java编写的) 安装sca ...

  2. 你不知道的JavaScript-- 事件流与事件处理

    转载:http://blog.csdn.net/i10630226/article/details/48970971 1. 事件处理 1.1. 绑定事件方式 (1)行内绑定 语法: //最常用的使用方 ...

  3. 231. Power of Two 342. Power of Four -- 判断是否为2、4的整数次幂

    231. Power of Two Given an integer, write a function to determine if it is a power of two. class Sol ...

  4. 重载Array类的contains方法

    var allFilters = self.filtersContainer?.filters ?? [OpalFilter]() if let sorter = filtersContainer?. ...

  5. 递归算法(一)——akm

    要求 已知akm函数如下: { n+1 while m=0 }                          => Rule I akm(m,n)= { akm(m-1,1) while n ...

  6. PHP5生成条形码器

    前阵子在做一个商家优惠券的功能,需要用到条形码,于是将资料重新整理下. 1.什么是条形码? 百度百科定义:条形码(barcode)是将宽度不等的多个黑条和空白,按照一定的编码规则排列,用以表达一组信息 ...

  7. 使用WebView视图显示网页-----迷你浏览器

    Android提供了WebView组件,表面上来看,这个组件与普通ImageView差不多,但实际上,这个组件的功能要强大得多,WebView组件本身就是一个浏览器实现,它的内核基于开源WebKit引 ...

  8. Java longTime 和C#日期转换

    封装一下,可直接用. 以后碰到java的long time,直接使用DateTime dt=ConvertJavaDateTimeToNetTime(1207969641193);这样使用即可. 这串 ...

  9. jquery插件理解看这

    zepto 插件写法 一个更换背景颜色的小插件 html 1 <div id="box">content</div> javascript 12345678 ...

  10. ubuntu 防火墙 添加策略 解决mysql远程访问问题

    ubuntu 的iptables 文件不在 init.d中 不能 service iptables restart 只修改 /etc/iptables 文件也不管用 sudo iptables -L ...