mscorlib(4.0.0.0) API with additions
SerializationInfoEnumerator.cs
1 using System.Collections;
3 
5 {
7  [ComVisible(true)]
9  {
10  private string[] m_members;
11 
12  private object[] m_data;
13 
14  private Type[] m_types;
15 
16  private int m_numItems;
17 
18  private int m_currItem;
19 
20  private bool m_current;
21 
25  object IEnumerator.Current
26  {
27  get
28  {
29  if (!m_current)
30  {
31  throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_EnumOpCantHappen"));
32  }
33  return new SerializationEntry(m_members[m_currItem], m_data[m_currItem], m_types[m_currItem]);
34  }
35  }
36 
40  public SerializationEntry Current
41  {
42  get
43  {
44  if (!m_current)
45  {
46  throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_EnumOpCantHappen"));
47  }
48  return new SerializationEntry(m_members[m_currItem], m_data[m_currItem], m_types[m_currItem]);
49  }
50  }
51 
55  public string Name
56  {
57  get
58  {
59  if (!m_current)
60  {
61  throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_EnumOpCantHappen"));
62  }
63  return m_members[m_currItem];
64  }
65  }
66 
70  public object Value
71  {
72  get
73  {
74  if (!m_current)
75  {
76  throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_EnumOpCantHappen"));
77  }
78  return m_data[m_currItem];
79  }
80  }
81 
85  public Type ObjectType
86  {
87  get
88  {
89  if (!m_current)
90  {
91  throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_EnumOpCantHappen"));
92  }
93  return m_types[m_currItem];
94  }
95  }
96 
97  internal SerializationInfoEnumerator(string[] members, object[] info, Type[] types, int numItems)
98  {
99  m_members = members;
100  m_data = info;
101  m_types = types;
102  m_numItems = numItems - 1;
103  m_currItem = -1;
104  m_current = false;
105  }
106 
110  public bool MoveNext()
111  {
112  if (m_currItem < m_numItems)
113  {
114  m_currItem++;
115  m_current = true;
116  }
117  else
118  {
119  m_current = false;
120  }
121  return m_current;
122  }
123 
125  public void Reset()
126  {
127  m_currItem = -1;
128  m_current = false;
129  }
130  }
131 }
void Reset()
Resets the enumerator to the first item.
object Value
Gets the value of the item currently being examined.
Definition: __Canon.cs:3
Provides information about, and means to manipulate, the current environment and platform....
Definition: Environment.cs:21
object Current
Gets the element in the collection at the current position of the enumerator.
Definition: IEnumerator.cs:15
Represents type declarations: class types, interface types, array types, value types,...
Definition: Type.cs:18
string Name
Gets the name for the item currently being examined.
The exception that is thrown when a method call is invalid for the object's current state.
Type ObjectType
Gets the type of the item currently being examined.
Holds the value, T:System.Type, and name of a serialized object.
Provides a formatter-friendly mechanism for parsing the data in T:System.Runtime.Serialization....
Supports a simple iteration over a non-generic collection.
Definition: IEnumerator.cs:9
bool MoveNext()
Updates the enumerator to the next item.