1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147
|
<?xml version="1.0" encoding="utf-8"?>
<Type Name="IEnumerator" FullName="System.Collections.IEnumerator" FullNameSP="System_Collections_IEnumerator" Maintainer="ecma">
<TypeSignature Language="ILASM" Value=".class interface public abstract IEnumerator" />
<TypeSignature Language="C#" Value="public interface IEnumerator" />
<TypeSignature Language="ILAsm" Value=".class public interface auto ansi abstract IEnumerator" />
<MemberOfLibrary>BCL</MemberOfLibrary>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyPublicKey>[00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00 ]</AssemblyPublicKey>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Interfaces />
<Attributes>
<Attribute>
<AttributeName>System.Runtime.InteropServices.ComVisible(true)</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.Runtime.InteropServices.Guid("496B0ABF-CDEE-11D3-88E8-00902754C43A")</AttributeName>
</Attribute>
</Attributes>
<Docs>
<remarks>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>
<see cref="T:System.Collections.IEnumerator" /> is the base interface for all non-generic enumerators.</para>
<para>For the generic version of this interface see <see cref="T:System.Collections.Generic.IEnumerator`1" />.</para>
<para>The foreach statement of the C# language (for each in Visual Basic) hides the complexity of the enumerators. Therefore, using foreach is recommended instead of directly manipulating the enumerator.</para>
<para>Enumerators can be used to read the data in the collection, but they cannot be used to modify the underlying collection.</para>
<para>Initially, the enumerator is positioned before the first element in the collection. The <see cref="M:System.Collections.IEnumerator.Reset" /> method also brings the enumerator back to this position. After an enumerator is created or the <see cref="M:System.Collections.IEnumerator.Reset" /> method is called, you must call the <see cref="M:System.Collections.IEnumerator.MoveNext" /> method to advance the enumerator to the first element of the collection before reading the value of <see cref="P:System.Collections.IEnumerator.Current" />; otherwise, <see cref="P:System.Collections.IEnumerator.Current" /> is undefined..</para>
<para>
<see cref="P:System.Collections.IEnumerator.Current" /> returns the same object until either <see cref="M:System.Collections.IEnumerator.MoveNext" /> or <see cref="M:System.Collections.IEnumerator.Reset" /> is called. <see cref="M:System.Collections.IEnumerator.MoveNext" /> sets <see cref="P:System.Collections.IEnumerator.Current" /> to the next element.</para>
<para>If <see cref="M:System.Collections.IEnumerator.MoveNext" /> passes the end of the collection, the enumerator is positioned after the last element in the collection and <see cref="M:System.Collections.IEnumerator.MoveNext" /> returns false. When the enumerator is at this position, subsequent calls to <see cref="M:System.Collections.IEnumerator.MoveNext" /> also return false. If the last call to <see cref="M:System.Collections.IEnumerator.MoveNext" /> returned false, calling <see cref="P:System.Collections.IEnumerator.Current" /> throws an exception. To set <see cref="P:System.Collections.IEnumerator.Current" /> to the first element of the collection again, you can call <see cref="M:System.Collections.IEnumerator.Reset" /> followed by <see cref="M:System.Collections.IEnumerator.MoveNext" />.</para>
<para>An enumerator remains valid as long as the collection remains unchanged. If changes are made to the collection, such as adding, modifying, or deleting elements, the enumerator is irrecoverably invalidated and the next call to <see cref="M:System.Collections.IEnumerator.MoveNext" /> or <see cref="M:System.Collections.IEnumerator.Reset" /> throws an <see cref="T:System.InvalidOperationException" />. If the collection is modified between <see cref="M:System.Collections.IEnumerator.MoveNext" /> and <see cref="P:System.Collections.IEnumerator.Current" />, <see cref="P:System.Collections.IEnumerator.Current" /> returns the element that it is set to, even if the enumerator is already invalidated.</para>
<para>The enumerator does not have exclusive access to the collection; therefore, enumerating through a collection is intrinsically not a thread-safe procedure. Even when a collection is synchronized, other threads can still modify the collection, which causes the enumerator to throw an exception. To guarantee thread safety during enumeration, you can either lock the collection during the entire enumeration or catch the exceptions resulting from changes made by other threads.</para>
</remarks>
<summary>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>Supports a simple iteration over a non-generic collection.</para>
</summary>
</Docs>
<Members>
<Member MemberName="Current">
<MemberSignature Language="ILASM" Value=".property object Current { public hidebysig virtual abstract specialname object get_Current() }" />
<MemberSignature Language="C#" Value="public object Current { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance object Current" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Object</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<value>
<para> The element in the collection over which the current instance is positioned.</para>
</value>
<exception cref="T:System.InvalidOperationException">
<para> The current instance is positioned before the first element or after the last element of the collection.</para>
<para>The collection was modified after the current instance was instantiated.</para>
</exception>
<remarks>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>After an enumerator is created or after the <see cref="M:System.Collections.IEnumerator.Reset" /> method is called, the <see cref="M:System.Collections.IEnumerator.MoveNext" /> method must be called to advance the enumerator to the first element of the collection before reading the value of the <see cref="P:System.Collections.IEnumerator.Current" /> property; otherwise, <see cref="P:System.Collections.IEnumerator.Current" /> is undefined.</para>
<para>
<see cref="P:System.Collections.IEnumerator.Current" /> also throws an exception if the last call to <see cref="M:System.Collections.IEnumerator.MoveNext" /> returned false, which indicates the end of the collection.</para>
<para>
<see cref="P:System.Collections.IEnumerator.Current" /> does not move the position of the enumerator, and consecutive calls to <see cref="P:System.Collections.IEnumerator.Current" /> return the same object until either <see cref="M:System.Collections.IEnumerator.MoveNext" /> or <see cref="M:System.Collections.IEnumerator.Reset" /> is called.</para>
<para>An enumerator remains valid as long as the collection remains unchanged. If changes are made to the collection, such as adding, modifying, or deleting elements, the enumerator is irrecoverably invalidated and the next call to <see cref="M:System.Collections.IEnumerator.MoveNext" /> or <see cref="M:System.Collections.IEnumerator.Reset" /> throws an <see cref="T:System.InvalidOperationException" />. If the collection is modified between <see cref="M:System.Collections.IEnumerator.MoveNext" /> and <see cref="P:System.Collections.IEnumerator.Current" />, <see cref="P:System.Collections.IEnumerator.Current" /> returns the element that it is set to, even if the enumerator is already invalidated.</para>
</remarks>
<summary>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>Gets the current element in the collection.</para>
</summary>
</Docs>
<Excluded>0</Excluded>
</Member>
<Member MemberName="MoveNext">
<MemberSignature Language="ILASM" Value=".method public hidebysig virtual abstract bool MoveNext()" />
<MemberSignature Language="C#" Value="public bool MoveNext ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance bool MoveNext() cil managed" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<exception cref="T:System.InvalidOperationException">
<para>The collection was modified after the current instance was instantiated.</para>
</exception>
<remarks>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>After an enumerator is created or after the <see cref="M:System.Collections.IEnumerator.Reset" /> method is called, an enumerator is positioned before the first element of the collection, and the first call to the <see cref="M:System.Collections.IEnumerator.MoveNext" /> method moves the enumerator over the first element of the collection.</para>
<para>If <see cref="M:System.Collections.IEnumerator.MoveNext" /> passes the end of the collection, the enumerator is positioned after the last element in the collection and <see cref="M:System.Collections.IEnumerator.MoveNext" /> returns false. When the enumerator is at this position, subsequent calls to <see cref="M:System.Collections.IEnumerator.MoveNext" /> also return false until <see cref="M:System.Collections.IEnumerator.Reset" /> is called.</para>
<para>An enumerator remains valid as long as the collection remains unchanged. If changes are made to the collection, such as adding, modifying, or deleting elements, the enumerator is irrecoverably invalidated and the next call to <see cref="M:System.Collections.IEnumerator.MoveNext" /> or <see cref="M:System.Collections.IEnumerator.Reset" /> throws an <see cref="T:System.InvalidOperationException" />.</para>
</remarks>
<summary>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>Advances the enumerator to the next element of the collection.</para>
</summary>
<returns>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>true if the enumerator was successfully advanced to the next element; false if the enumerator has passed the end of the collection.</para>
</returns>
</Docs>
<Excluded>0</Excluded>
</Member>
<Member MemberName="Reset">
<MemberSignature Language="ILASM" Value=".method public hidebysig virtual abstract void Reset()" />
<MemberSignature Language="C#" Value="public void Reset ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance void Reset() cil managed" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<exception cref="T:System.InvalidOperationException">The collection was modified after the enumerator was instantiated.</exception>
<remarks>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>An enumerator remains valid as long as the collection remains unchanged. If changes are made to the collection, such as adding, modifying, or deleting elements, the enumerator is irrecoverably invalidated and the next call to the <see cref="M:System.Collections.IEnumerator.MoveNext" /> or <see cref="M:System.Collections.IEnumerator.Reset" /> method throws an <see cref="T:System.InvalidOperationException" />.</para>
<para>The <see cref="M:System.Collections.IEnumerator.Reset" /> method is provided for COM interoperability. It does not necessarily need to be implemented; instead, the implementer can simply throw a <see cref="T:System.NotSupportedException" />.</para>
</remarks>
<summary>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>Sets the enumerator to its initial position, which is before the first element in the collection.</para>
</summary>
</Docs>
<Excluded>0</Excluded>
</Member>
</Members>
<TypeExcluded>0</TypeExcluded>
</Type>
|