BitCollections 1.0.1

.NET Core 3.1 .NET Standard 2.0 .NET Framework 4.5
dotnet add package BitCollections --version 1.0.1
NuGet\Install-Package BitCollections -Version 1.0.1
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="BitCollections" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add BitCollections --version 1.0.1
#r "nuget: BitCollections, 1.0.1"
#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.
// Install BitCollections as a Cake Addin
#addin nuget:?package=BitCollections&version=1.0.1

// Install BitCollections as a Cake Tool
#tool nuget:?package=BitCollections&version=1.0.1

Licensed under the MIT License NuGet


BitCollections is a library that provides efficient collections storing bit values. It provides two types:

  • BitSet: An immutable struct, allocation-free when small bit indices are stored.

  • BitArrayNeo: A mutable class, has a similar API with System.Collections.BitArray, its modification methods return whether the collection changed.

These two types can be converted and checked for equality against each other. Both implement IEnumerable<int>, returning the indices of their active bits.

Missing features

BitArrayNeo is not a drop-in replacement for BitArray. In particular, it is missing features like:

  • The LeftShift/RightShift methods
  • Some additional constructors (such as accepting an array of bytes or booleans)
  • SIMD acceleration

BitSet is missing some set-relational operators (such as IsSubsetOf) that might come in handy. They will be added in a future release.

Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows net7.0 net7.0-android net7.0-ios net7.0-maccatalyst net7.0-macos net7.0-tvos net7.0-windows
.NET Core netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard2.0 netstandard2.1
.NET Framework net45 net451 net452 net46 net461 net462 net463 net47 net471 net472 net48 net481
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen40 tizen60
Xamarin.iOS xamarinios
Xamarin.Mac xamarinmac
Xamarin.TVOS xamarintvos
Xamarin.WatchOS xamarinwatchos
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on BitCollections:

Package Downloads

Farkle is an LALR parser library with an API similar to parser combinators.


A library for parentage anlaysis using efficiently computed opposing homozygote counts of a sample set.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.1 2,314 1/26/2021
1.0.0 532 8/11/2020

Fix an enumeration bug on bit collections whose smallest element is at least 128.
Use consistent casing in the bit collections' ToString representation.
Update framework dependencies.