CSharpTest.Net
OrdinalList Class
Members  Example  See Also  Send Feedback Download Help File
CSharpTest.Net.Library Assembly > CSharpTest.Net.Collections Namespace : OrdinalList Class

Glossary Item Box

An ordinal list is a list optimized to store lists of integer data that can then be manipulated as a set with intersect/union etc. Each integer stored is translated to a bit offset and thus cann't be stored more than once or in any particular order. Note: adding the value int.Max will allocate int.Max/8 bytes of memory, so this is best used with ordinal indexes into a list that is smaller than 8,388,608 (one megabyte of bits). Pre-allocate with Ceiling = max for better performance, or add the integers in reverse order (highest to lowest).

Syntax

Visual Basic (Declaration) 
Public Class OrdinalList 
C# 
public class OrdinalList 

Example

Previously it was thought to be invalid to set a negative ceiling; however, since ceiling is an 'inclusive' value, the value of '0' actually requires 1 byte to be allocated. In order to allow explicitly clearing the array length, a -1 must be allowed;

Library/Library.Test/TestOrdinalList.cs

C#Copy Code
OrdinalList list = new OrdinalList();
list.Ceiling = -1;
Assert.AreEqual(-1, list.Ceiling);
VB.NETCopy Code
Dim list As New OrdinalList()
list.Ceiling = -1
Assert.AreEqual(-1, list.Ceiling)

Inheritance Hierarchy

System.Object
   CSharpTest.Net.Collections.OrdinalList

Requirements

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

See Also

Generated with Document! X 2011 by Innovasys