随笔分类 -  GetEnumerator 方法(转C#源码)

摘要:下面的代码示例演示如何实现自定义集合的 IEnumerable 接口。在此示例中,没有显式调用但实现了 GetEnumerator,以便支持使用 foreach(在 Visual Basic 中为 for each)。此代码示例摘自 IEnumerable 接口的一个更大的示例。view plaincopy to clipboardprint?public class People : IEnum... 阅读全文
posted @ 2007-08-11 14:06 过河卒A 阅读(8153) 评论(3) 推荐(0)
摘要:下面的代码示例演示如何使用 GetEnumerator 方法来创建 System.Collections.IEnumerator 接口,该接口可被循环访问以显示 DataGridColumnCollection 集合的内容。view plaincopy to clipboardprint? DataGridCo... 阅读全文
posted @ 2007-08-11 14:05 过河卒A 阅读(981) 评论(0) 推荐(0)
摘要:示例说明如何使用 GetEnumerator 方法创建一个实现了 System.Collections.IEnumerator 的对象。然后循环访问该对象以显示选定行中的项。view plaincopy to clipboardprint? TableCellCollection Example ... 阅读全文
posted @ 2007-08-11 14:04 过河卒A 阅读(1202) 评论(0) 推荐(0)
摘要:下面的代码示例使用 GetEnumerator 方法显示输入字符串中的每个 System.Char。view plaincopy to clipboardprint?// Example for the String.GetEnumerator( ) method. using System; using System.Collections; class GetEnumerato... 阅读全文
posted @ 2007-08-11 14:02 过河卒A 阅读(2003) 评论(0) 推荐(0)
摘要:下面的示例演示如何使用 GetEnumerator 方法检索一个枚举数,该枚举数包含集合中的值。然后,循环访问该枚举数,并将第一个单元格的值显示在页上。view plaincopy to clipboardprint? GridViewRowCollection GetEnumerator Example ... 阅读全文
posted @ 2007-08-11 13:59 过河卒A 阅读(778) 评论(1) 推荐(0)
摘要:下面的代码示例阐释了如何使用 GetEnumerator 方法。view plaincopy to clipboardprint?// Get 'Validators' of the page to myCollection. ValidatorCollection myCollection = Page.Validators; // Get the Enumerator. IEn... 阅读全文
posted @ 2007-08-11 13:57 过河卒A 阅读(316) 评论(0) 推荐(0)
摘要:下面的示例展示如何使用 GetEnumerator 方法创建一个实现了 System.Collections.IEnumerator 的对象,该对象被循环访问以显示表中的项。view plaincopy to clipboardprint? TableCellCollection Example ... 阅读全文
posted @ 2007-08-11 13:56 过河卒A 阅读(1162) 评论(0) 推荐(0)
摘要:下面的代码示例演示如何使用 GetEnumerator 方法创建 System.Collections.IEnumerator 对象。然后循环访问 System.Collections.IEnumerator 对象以显示 HtmlTableRowCollection 集合的内容。view plaincopy to clipboardprint? ... 阅读全文
posted @ 2007-08-11 13:54 过河卒A 阅读(625) 评论(0) 推荐(0)