entitysetenumerator.cs

来自「用于c#.net数据库操作的类库。能把结婚集以数组的形成操作。」· CS 代码 · 共 49 行

CS
49
字号
using System;
using System.Collections;

namespace EnterpriseObjects
{
	/// <summary>
	/// Summary description for EntitySetEnumerator.
	/// </summary>
	public class EntitySetEnumerator : IEnumerator
	{
		// members...
		public int TableIndex;
		public EntitySet EntitySet;
		public int Position = -1;

		// constructor...
		public EntitySetEnumerator(EntitySet entitySet) : this(0, entitySet)
		{
		}

		public EntitySetEnumerator(int tableIndex, EntitySet entitySet)
		{
			this.TableIndex = tableIndex;
			this.EntitySet = entitySet;
		}

		public object Current
		{
			get
			{
				return EntitySet.GetEntity(TableIndex, Position);
			}
		}

		public bool MoveNext() 
		{
			if(Position == EntitySet.GetCount(TableIndex) - 1)
				return false;
			Position += 1;
			return true;
		}

		public void Reset()
		{
			Position = -1;
		}
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?