CSharpTest.Net
OrderedEnumeration<T> Constructor(IEnumerable<T>)
See Also  Example Send Feedback Download Help File
CSharpTest.Net.Library Assembly > CSharpTest.Net.Collections Namespace > OrderedEnumeration<T> Class > OrderedEnumeration<T> Constructor : OrderedEnumeration<T> Constructor(IEnumerable<T>)

unordered

Glossary Item Box

Constructs an ordered enumeration from an unordered enumeration

Syntax

Visual Basic (Declaration) 
Public Function New( _
   ByVal unordered As IEnumerable(Of T) _
)
C# 
public OrderedEnumeration<T>( 
   IEnumerable<T> unordered
)

Parameters

unordered

Example

Library/Library.Test/TestOrderedEnumeration.cs

C#Copy Code
var order = new OrderedEnumeration<byte>(new byte[1]);
System.Collections.IEnumerator e = ((System.Collections.IEnumerable)order).GetEnumerator();
Assert.IsTrue(e.MoveNext());
Assert.IsFalse(e.MoveNext());
try
{
    object val = e.Current;
    GC.KeepAlive(val);
    Assert.Fail();
}
catch (InvalidOperationException) { }

try
{
    e.Reset();
    Assert.Fail();
}
catch (NotSupportedException) { }
VB.NETCopy Code
Dim order As var = New OrderedEnumeration(Of Byte)(New Byte(1) {})
Dim e As System.Collections.IEnumerator = (DirectCast(order, System.Collections.IEnumerable)).GetEnumerator()
Assert.IsTrue(e.MoveNext())
Assert.IsFalse(e.MoveNext())
Try
    Dim val As Object = e.Current
    GC.KeepAlive(val)
    Assert.Fail()
Catch generatedExceptionName As InvalidOperationException
End Try

Try
    e.Reset()
    Assert.Fail()
Catch generatedExceptionName As NotSupportedException
End Try

Requirements

Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7

See Also

Generated with Document! X 2011 by Innovasys