C# foreach语句遍历集合类型演示范例的代码
2021-06-05 05:03
标签:har res get nts bool lse return each 内容 C# foreach语句遍历集合类型演示范例的代码 标签:har res get nts bool lse return each 内容 原文地址:https://blog.51cto.com/14314834/2388691using System;
using System.Collections;
public class Tokens: IEnumerable
{
private string[] elements;
Tokens(string source, char[] delimiters)
{
elements = source.Split(delimiters);
}
{
return new TokenEnumerator(this);
}
{
return (IEnumerator) new TokenEnumerator(this);
}
public class TokenEnumerator: IEnumerator
{
private int position = -1;
private Tokens t;
public TokenEnumerator(Tokens t)
{
this.t = t;
}
public bool MoveNext()
{
if (position
上一篇:windows下安装pip
下一篇:C# 执行外部命令的代码