Open.Collections 2.7.0

.NET Standard 2.0
There is a newer version of this package available.
See the version list below for details.
dotnet add package Open.Collections --version 2.7.0
NuGet\Install-Package Open.Collections -Version 2.7.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="Open.Collections" Version="2.7.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Open.Collections --version 2.7.0
#r "nuget: Open.Collections, 2.7.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install Open.Collections as a Cake Addin
#addin nuget:?package=Open.Collections&version=2.7.0

// Install Open.Collections as a Cake Tool
#tool nuget:?package=Open.Collections&version=2.7.0

Synchronized Collections

Keeping in mind that without an exclusive lock of some kind, the data can change from one operation to the next.

These classes are provided to help with simple operations that don't rely on lengthy exclusive locking.

Some methods are available that assist with exclusive access:

  • .IfContains(item, action)
  • .IfNotContains(item, action)
  • .Snapshot()
  • .ForEach(action, useSnapshot)
  • .Export(destination)
  • .CopyTo(array, arrayIndex)
  • .Modify(action)

A "snapshot" is simply a copy of the collection at a given moment that can then be operated on while the underlying collection can continue to mutate.


Any operation that the collection cannot be changing (adding/removing) while executing.
ie. .Contains(item)


Any operation that will change (add/remove an entry in) the collection.

Lock Synchronized

Most of these classes synchronize access very fast when a simple Monitor (lock) is used properly.

Best to use these classes when expecting a mix of read/write but with a majority of writes.

Read-Write Synchronized

These classes use a ReaderWriterLockSlim to synchronize read-write access and can be faster in some specific cases.

Best to use these classes when expecting a mix of read/write but with a majority of reads and typically of a smaller size.


Important Observations:

  • Be sure to benchmark the 'Release' configuration as the difference in performance versus 'Debug' can be dramatic.
  • Observe results on different machines with different core counts.
  • As collection sizes increase, performance behavior changes. For example, for smaller collection sizes (~1000 or less) Read-Write synchronization wins most of the time. But larger than that, a 'lock' for writes begins to out perform.
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 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 (3)

Showing the top 3 NuGet packages that depend on Open.Collections:

Package Downloads

Methods and extensions for prime number detection and discovery. Part of the "Open" set of libraries.


Package Description


Useful set of extensions for processing collections of numerical data. Part of the "Open" set of libraries.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
3.1.2 5,463 9/12/2022
3.1.1 2,193 8/7/2022
3.1.0 438 4/20/2022
3.0.2 222 8/7/2022
3.0.1 237 4/17/2022
3.0.0 1,384 4/12/2022
2.12.10 323 3/4/2022
2.12.9 278 2/25/2022
2.12.8 399 10/13/2021
2.12.7 234 9/29/2021
2.12.5 335 9/21/2021
2.12.4 283 8/23/2021
2.12.3 293 8/21/2021
2.12.2 316 7/12/2021
2.12.1 312 7/9/2021
2.10.1 497 6/30/2021
2.10.0 314 6/29/2021
2.8.0 37,545 7/17/2020
2.7.2 12,978 1/4/2020
2.7.1 654 1/3/2020
2.7.0 17,139 7/5/2019