.NET:有没有"规则hasNext"方法一个IEnumerator? [英] .NET: is there a "HasNext" method for an IEnumerator?

查看:189
本文介绍了.NET:有没有"规则hasNext"方法一个IEnumerator?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Java的的Iterator S,我已经使用了规则hasNext 方法来确定一个迭代是否有更多的元素(不耗时一个元素) - 因此,规则hasNext 就像是一个皮克的方法。

With Java Iterators, I have used the hasNext method to determine whether an iteration has more elements (without consuming an element) -- thus, hasNext is like a "Peek" method.

我的问题:是否有像规则hasNext 皮克的方法什么用C#的通用的IEnumerator S'

My question: is there anything like a "hasNext" or "Peek" method with C#'s generic IEnumerators?

推荐答案

没有,遗憾的ISN吨。

No, unfortunately there isn't.

IEnumerator的< T> 接口只公开以下成员:

The IEnumerator<T> interface only exposes the following members:

方法:

的Dispose

的MoveNext

重置

< STRONG>属性

当前

这篇关于.NET:有没有&QUOT;规则hasNext&QUOT;方法一个IEnumerator?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆