Open.Collections 2.7.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 and Polyglot Notebooks. 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.

Reads

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

Writes

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.

Benchmarks

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 Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (3)

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

Package Downloads
PGCG.commonItems

Package Description

Open.Numeric.Primes

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

Open.Collections.Numeric

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.2.0 2,992 11/22/2023
3.1.5 552 11/5/2023
3.1.4 96 11/4/2023
3.1.3 290 10/28/2023
3.1.2 16,646 9/12/2022
3.1.1 2,874 8/7/2022
3.1.0 752 4/20/2022
3.0.2 398 8/7/2022
3.0.1 413 4/17/2022
3.0.0 2,302 4/12/2022
2.12.10 838 3/4/2022
2.12.9 450 2/25/2022
2.12.8 654 10/13/2021
2.12.7 358 9/29/2021
2.12.5 441 9/21/2021
2.12.4 382 8/23/2021
2.12.3 385 8/21/2021
2.12.2 416 7/12/2021
2.12.1 410 7/9/2021
2.10.1 685 6/30/2021
2.10.0 418 6/29/2021
2.8.0 45,406 7/17/2020
2.7.2 13,521 1/4/2020
2.7.1 817 1/3/2020
2.7.0 18,016 7/5/2019