C#中的CharEnumerator.MoveNext()方法
C#中的CharEnumerator.MoveNext()方法用于将当前CharEnumerator对象的内部索引递增到枚举字符串的下一个字符。
语法
public bool MoveNext ();
现在让我们看一个实现CharEnumerator.MoveNext()方法的示例-
示例
using System;
public class Demo {
public static void Main(){
string strNum = "john";
CharEnumerator ch = strNum.GetEnumerator();
Console.WriteLine("HashCode = "+ch.GetHashCode());
Console.WriteLine("Get the Type = "+ch.GetType());
while (ch.MoveNext())
Console.Write(ch.Current + " ");
//处置
ch.Dispose();
// this will show an error since we处置 the object above
//Console.WriteLine(ch.Current);
}
}输出结果
这将产生以下输出-
HashCode = 1373506 Get the Type = System.CharEnumerator j o h n
热门推荐
1 如何训练狗狗不叫
2 训练狗狗不叫
3 训练狗狗随行
4 怎么训练狗狗不叫
7 训练比熊狗狗教程
10 上海狗狗训练
11 怎么训练狗狗上厕所
12 训练狗狗趴下
13 狗狗服从训练
14 训练狗狗拒食
15 训练狗狗笑
16 训练狗狗大便
17 训练狗狗立
18 训练狗狗捡东西