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

contents

Glossary Item Box

Constructs an OrdinalList from the integer ordinals provided

Syntax

Visual Basic (Declaration) 
Public Function New( _
   ByVal contents As IEnumerable(Of Integer) _
)
C# 
public OrdinalList( 
   IEnumerable<int> contents
)

Parameters

contents

Example

Library/Library.Test/TestOrdinalList.cs

C#Copy Code
OrdinalList lista = new OrdinalList(new int[] { 1, 4, 5 });
OrdinalList listb = new OrdinalList(new int[] { 2, 4, 6 });

OrdinalList union = lista.UnionWith(listb);
Assert.AreEqual(5, union.Count);
foreach (int i in union)
    Assert.IsTrue(lista.Contains(i) || listb.Contains(i));

OrdinalList inter = lista.IntersectWith(listb);
Assert.AreEqual(1, inter.Count);
foreach (int i in inter)
    Assert.AreEqual(4, i);
VB.NETCopy Code
Dim lista As New OrdinalList(New Integer() {1, 4, 5})
Dim listb As New OrdinalList(New Integer() {2, 4, 6})

Dim union As OrdinalList = lista.UnionWith(listb)
Assert.AreEqual(5, union.Count)
For Each i As Integer In union
    Assert.IsTrue(lista.Contains(i) OrElse listb.Contains(i))
Next

Dim inter As OrdinalList = lista.IntersectWith(listb)
Assert.AreEqual(1, inter.Count)
For Each i As Integer In inter
    Assert.AreEqual(4, i)
Next

Requirements

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

See Also

Generated with Document! X 2011 by Innovasys