Oakrey.BitArray 4.0.0

dotnet add package Oakrey.BitArray --version 4.0.0
                    
NuGet\Install-Package Oakrey.BitArray -Version 4.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Oakrey.BitArray" Version="4.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Oakrey.BitArray" Version="4.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Oakrey.BitArray" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Oakrey.BitArray --version 4.0.0
                    
#r "nuget: Oakrey.BitArray, 4.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Oakrey.BitArray@4.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Oakrey.BitArray&version=4.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Oakrey.BitArray&version=4.0.0
                    
Install as a Cake Tool

Oakrey.BitArray

Oakrey.BitArray provides compact bit-level storage and numeric read/write helpers for binary protocols, device data, packed flags, and custom encodings.

Features

  • Compact FastBitArray backed by ulong[] words.
  • Bit access through Get, Set, indexers, Flip, SetAll, and Clear.
  • Fast helper methods: CountSetBits, AnySet, AllSet, GetSlice, GetRawArray, and ToByteArray.
  • NumericBitArray helpers for reading and writing byte, signed integer, unsigned integer, decimal, and double values from arbitrary bit ranges.
  • Offset and scale support for encoded numeric values.
  • Zigzag ushort read/write helpers for specialized 16-bit layouts.
  • Dedicated range validation through BitArrayOutOfRangeException.
  • IEnumerable<bool> support for LINQ and foreach iteration.

Installation

.NET CLI

dotnet add package Oakrey.BitArray

Package Manager Console

Install-Package Oakrey.BitArray

Usage

using Oakrey.BitArray;

FastBitArray bits = new(10);
bits.Set(0, true);
bits.Flip(9);

int enabledBits = bits.CountSetBits();
byte[] packed = bits.ToByteArray();

NumericBitArray numeric = new(32);
numeric.SetUInt32(0, 16, 0xBEEF);
ushort value = numeric.GetUInt16(0, 16);

Numeric Scaling

NumericBitArray payload = new(16);
payload.SetDouble(0, 16, offset: -40, scale: 0.1, value: 21.5);

double temperature = payload.GetDouble(0, 16, offset: -40, scale: 0.1);

SetDouble, GetDouble, and zigzag helpers validate non-finite double values. Set methods that divide by scale reject zero scale.

Requirements

  • .NET 10

Project Information

License

This project is licensed under the MIT License. See the LICENSE file for details.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.

NuGet packages (4)

Showing the top 4 NuGet packages that depend on Oakrey.BitArray:

Package Downloads
Oakrey.DBC

Oakrey.DBC is a .NET 10 library for parsing, building, and exporting DBC (CAN database) files. Provides a full object model covering messages, signals (including multiplexing, big/little endian, scale/offset), nodes, attributes, value tables, and relationships. Supports async file parsing via DbcMatrix.CreateAsync and round-trip export via SaveDBC. Designed for automotive, industrial, and IoT applications.

Oakrey.Network.Abstractions

Foundational .NET abstractions for network packet parsing and address management. Includes base classes and interfaces for Ethernet, IPv4, and IPv6 packet headers (MacPacketHead, IPv4PacketHead, IPv6PacketHead), transport and network layer abstractions, protocol enums (EtherType, IpProtocol), IP address range types, and raw packet utilities. Integrates with PacketDotNet.

Oakrey.DBC.Values

Oakrey.DBC.Values is a .NET 10 library that adds live signal value handling on top of Oakrey.DBC. SignalValue wraps a DBC Signal template with NumericBitArray-backed raw and scaled double access, implements INotifyPropertyChanged for data-binding support, and tracks decimal precision from the signal scale. TaskMessage composes a full CAN message payload from its signal set, supports mux-ID dispatch in SetValues, and maintains a rolling receive history via FixedSizedQueue. Designed for automotive, industrial, and IoT CAN data processing.

Oakrey.LDF.Values

Runtime value layer for LIN frames and signals built on top of Oakrey.LDF. Provides LdfSignalValue with INotifyPropertyChanged and physical value decoding via encoding offset and scale, and LdfTaskFrame for composing and parsing raw LIN message bytes across all positioned signals.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
4.0.0 94 7/13/2026
3.0.0 659 12/16/2025
2.0.0 395 11/13/2025
1.0.1 196 9/26/2025
1.0.0 441 4/16/2025