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!
热门推荐
7 火把节祝福语简短
10 新年祝福语简短俏皮文案
11 给表妹生日祝福语简短
12 送给客人简短的祝福语
13 对转校同学祝福语简短
14 牛年公司新年祝福语简短
15 新年祝福语简短的感谢
16 新年孕妈祝福语简短
17 完成预算祝福语简短精辟