~halega/+junk/sharpdevelop

« back to all changes in this revision

Viewing changes to samples/ComponentInspector/ComponentInspector.Core/Src/Debug/EnumHolder.cs

  • Committer: sk
  • Date: 2011-09-10 05:17:57 UTC
  • Revision ID: halega@halega.com-20110910051757-qfouz1llya9m6boy
4.1.0.7915 Release Candidate 1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// <file>
 
2
//     <copyright see="prj:///doc/copyright.txt"/>
 
3
//     <license see="prj:///doc/license.txt"/>
 
4
//     <owner name="Oakland Software Incorporated" email="general@oaklandsoftware.com"/>
 
5
//     <version>$Revision$</version>
 
6
// </file>
 
7
 
 
8
using System;
 
9
using System.Collections;
 
10
using CORDBLib_1_0;
 
11
 
 
12
namespace NoGoop.Debug
 
13
{
 
14
        public class EnumHolder : IEnumerator
 
15
        {
 
16
                protected ICorDebugAppDomainEnum    _debugEnum;
 
17
                protected int                       _position;
 
18
                protected uint                      _count;
 
19
                protected ICorDebugAppDomain        _current;
 
20
 
 
21
                public EnumHolder(ICorDebugAppDomainEnum debugEnum)
 
22
                {
 
23
                        _debugEnum = debugEnum;
 
24
                        _count = _debugEnum.GetCount();
 
25
                }
 
26
 
 
27
                public Object Current {
 
28
                        get {
 
29
                                return _current;
 
30
                        }
 
31
                }
 
32
 
 
33
                public bool MoveNext()
 
34
                {
 
35
                        uint gotNum = _debugEnum.Next(1, out _current);
 
36
                        _position += 1;
 
37
                        if (_position > _count)
 
38
                                return false;
 
39
                        return true;
 
40
                }
 
41
 
 
42
                public void Reset()
 
43
                {
 
44
                        _debugEnum.Reset();
 
45
                        _position = -1;
 
46
                }
 
47
        }
 
48
}