Files
hjha-server/MrWu/core/Enumerator.cs
xiaoou e9616125ce feat: initial commit - HJHA game server full source
6 major server modules (PdkFriendServer/GlobalSever/ServerCore/GameModule/GameNetModule) +
game logic (GameFix/GameDAL/ServerData) +
network layer (NetWorkMessage) +
data layer (ObjectModel) +
utilities (MrWu/Core/Config/CloudAPI/dll) +
adapters (zyxAdapter/base)

.NET 8.0 C# solution, 16 projects, 958 source files
2026-07-07 12:02:15 +08:00

76 lines
1.6 KiB
C#

using System;
using System.Collections;
using System.Collections.Generic;
namespace MrWu.core
{
/// <summary>
///
/// </summary>
public struct ArrayEnumerator<T> : IEnumerator<T>, IEnumerator
{
private T[] array;
private int index;
private T current;
/// <summary>
/// 迭代器
/// </summary>
/// <param name="array"></param>
public ArrayEnumerator(T[] array) {
this.array = array;
index = 0;
current = default(T);
}
/// <summary>
/// 下一个
/// </summary>
/// <returns></returns>
public bool MoveNext() {
if (index < array.Length) {
current = array[index];
index++;
return true;
}
return MoveNextRare();
}
private bool MoveNextRare() {
index = array.Length + 1;
return false;
}
/// <summary>
/// 当前的值
/// </summary>
public T Current {
get {
return current;
}
}
Object IEnumerator.Current {
get {
return Current;
}
}
/// <summary>
///
/// </summary>
public void Dispose() { }
/// <summary>
/// 重置
/// </summary>
public void Reset() {
index = 0;
current = default(T);
}
}
}