Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Collections;
- namespace AlgoDS_Labb1
- {
- class BagEnumerator<T> : IEnumerator<T>
- {
- private Bag<T> thebag;
- public BagEnumerator(Bag<T> a)
- {
- thebag = a;
- }
- int position = -1;
- public T Current
- {
- get
- {
- return thebag.IndexReturn(position);
- }
- }
- object IEnumerator.Current
- {
- get
- {
- return Current;
- }
- }
- public bool MoveNext()
- {
- position++;
- return (position < thebag.Items.Length);
- }
- public void Reset()
- {
- position = -1;
- }
- public void Dispose()
- {
- }
- }
- }
Add Comment
Please, Sign In to add comment