Visual Basic (Declaration) | |
---|---|
Public Function GetEnumerator() As IEnumerator(Of T) |
C# | |
---|---|
public IEnumerator<T> GetEnumerator() |
Exception | Description |
---|---|
System.InvalidOperationException | GetEnumerator() may only be called once. |
System.IO.InvalidDataException | Enumeration is out of sequence. |
System.ArgumentException | Duplicate item in enumeration. |
Library/Library.Test/TestOrderedEnumeration.cs
C# | Copy Code |
---|---|
var ordered = new OrderedEnumeration<byte>(new byte[0]); using (var e = ordered.GetEnumerator()) Assert.IsFalse(e.MoveNext()); try { ((System.Collections.IEnumerable) ordered).GetEnumerator(); Assert.Fail(); } catch (InvalidOperationException) { } |
VB.NET | Copy Code |
---|---|
Dim ordered As var = New OrderedEnumeration(Of Byte)(New Byte(0) {}) Using e As var = ordered.GetEnumerator() Assert.IsFalse(e.MoveNext()) End Using Try (DirectCast(ordered, System.Collections.IEnumerable)).GetEnumerator() Assert.Fail() Catch generatedExceptionName As InvalidOperationException End Try |
Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7