Skip to Main Content
C# in a Nutshell
book

C# in a Nutshell

by Ben Albahari, Ted Neward, Peter Drayton
March 2002
Intermediate to advanced content levelIntermediate to advanced
864 pages
31h 8m
English
O'Reilly Media, Inc.
Content preview from C# in a Nutshell

Name

BitVector32

Synopsis

This structure defines a lightweight bit vector that can store booleans and 16-bit integers in a 32-bit structure. Sections hold single, 16-bit integer values and are the building blocks of a BitVector32. Sections are created with CreateSection(). Each section is constructed with a maximum value for the integer it can hold. Except for the initial section, each subsequent section must provide a reference to the previous section in addition to the maximum value.

The indexer (this operator) takes two forms. When indexed by a section name, that section’s value can be set or retrieved. When indexed by an integer that specifies a bit in the vector, you can determine whether that bit is set or not (true or false).

public struct BitVector32 {
// Public Constructors
   public method BitVector32(BitVector32 value);  
   public method BitVector32(int data);  
// Public Instance Properties
   public field int Data{get; } 
   public field int this{set; get; } 
   public field bool this{set; get; } 
// Public Static Methods
   public static method int CreateMask();  
   public static method int CreateMask(int previous);  
   public static method Section CreateSection(
        short maxValue);  
   public static method Section CreateSection(short maxValue, 
        Section previous);  
   public static method string ToString(BitVector32 value);  
// Public Instance Methods
   public override method bool Equals(object o);                // overrides ValueType
   public override method int GetHashCode();                     // overrides ValueType public override method string ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

C# 8.0 in a Nutshell

C# 8.0 in a Nutshell

Joseph Albahari, Eric Johannsen
C# 10 in a Nutshell

C# 10 in a Nutshell

Joseph Albahari
C# in a Nutshell, Second Edition

C# in a Nutshell, Second Edition

Peter Drayton, Ben Albahari, Ted Neward
Code like a Pro in C#

Code like a Pro in C#

Jort Rodenburg

Publisher Resources

ISBN: 0596001819Catalog PageErrata