IEnumerable 接口

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

using System;
using System.Collections;

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

阅读全文
类别:c# 语言参考 查看评论
posted @ 2008-07-18 15:33  酷歌  阅读(136)  评论(0)    收藏  举报