C#中的CharEnumerator.ToString()方法
C#中的CharEnumerator.ToString()方法获取代表当前对象的字符串。
语法
以下是语法-
public virtual string ToString();
示例
现在让我们看一个实现CharEnumerator.ToString()方法的示例-
using System;
public class Demo {
public static void Main(){
string strNum = "This is it!";
CharEnumerator ch = strNum.GetEnumerator();
Console.WriteLine("HashCode = "+ch.GetHashCode());
Console.WriteLine("Get the Type = "+ch.GetType());
Console.WriteLine("\nString representation = "+ch.ToString());
while (ch.MoveNext())
Console.Write(ch.Current + " ");
ch.Reset();
Console.WriteLine();
while (ch.MoveNext())
Console.Write(ch.Current);
}
}输出结果
这将产生以下输出-
HashCode = 31020903 Get the Type = System.CharEnumerator String representation = System.CharEnumerator T h i s i s i t ! This is it!
热门推荐
10 儿子立冬祝福语简短独特
11 对当兵的祝福语简短
12 侄儿高考试祝福语简短
13 伴郎红包祝福语朋友简短
14 媳妇生日简短祝福语朋友
15 公司年会祝福语简短最好
16 元旦感恩祝福语简短大全
17 红包祝福语简短10字
18 周六早晨祝福语简短