/// <summary> /// Paramaterized constructor which takes the collection which this enumerator will enumerate /// </summary> /// <param name="collection"></param> public BusinessObjectEnumerator(BusinessObjectCollection <T> collection) { _collection = collection; index = -1; _current = default(T); }
/// <summary> /// Explicit non-generic interface implementation for IEnumerator (extended and required by IEnumerator<T>) /// </summary> #endregion #region "Methods" /// <summary> /// Dispose method /// </summary> public virtual void Dispose() { _collection = null; _current = default(T); index = -1; }
static void Main(string[] args) { Console.ForegroundColor = System.ConsoleColor.Yellow; Console.WriteLine("*****************************BusinessObjectCollection*******************************"); BusinessObjectCollection <Person> boCollection = new BusinessObjectCollection <Person>() { new Person() { FirstName = "shareef", LastName = "bhat" }, new Person() { FirstName = "Umer", LastName = "bhat" }, new Person() { FirstName = "Ruhe", LastName = "bhat" }, new Person() { FirstName = "kulsum", LastName = "bhat" }, new Person() { FirstName = "Abida", LastName = "bhat" } }; foreach (var item in boCollection) { Console.WriteLine("GUID : " + item.UniqueId + ", " + item.FirstName + ", " + item.LastName); } Console.ForegroundColor = System.ConsoleColor.White; Console.WriteLine("*****************************BusinessEnumerator*******************************"); BusinessObjectEnumerator <Person> boEnumerable = new BusinessObjectEnumerator <Person>() { new Person() { FirstName = "shareef", LastName = "bhat" }, new Person() { FirstName = "Umer", LastName = "bhat" }, new Person() { FirstName = "Ruhe", LastName = "bhat" }, new Person() { FirstName = "kulsum", LastName = "bhat" }, new Person() { FirstName = "Abida", LastName = "bhat" } }; foreach (var item in boEnumerable) { Console.WriteLine("GUID : " + item.UniqueId + ", " + item.FirstName + ", " + item.LastName); } }