IEnumerable 接口

it2022-05-09  15

下面的代码示例演示如何实现自定义集合的 IEnumerable 和 IEnumerator 接口。在此示例中,没有显式调用这些接口的成员,但实现了它们,以便支持使用 foreach(在 Visual Basic 中为 for each)循环访问该集合。

using System; using System.Collections;

public class Person {     public Person(string fName, string lName)     {        

阅读全文 类别: c# 语言参考  查看评论

转载于:https://www.cnblogs.com/coogle/archive/2008/07/18/1246143.html


最新回复(0)