Soenneker.Atomics.Strings 4.0.18

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package Soenneker.Atomics.Strings --version 4.0.18
                    
NuGet\Install-Package Soenneker.Atomics.Strings -Version 4.0.18
                    
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="Soenneker.Atomics.Strings" Version="4.0.18" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soenneker.Atomics.Strings" Version="4.0.18" />
                    
Directory.Packages.props
<PackageReference Include="Soenneker.Atomics.Strings" />
                    
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 Soenneker.Atomics.Strings --version 4.0.18
                    
#r "nuget: Soenneker.Atomics.Strings, 4.0.18"
                    
#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 Soenneker.Atomics.Strings@4.0.18
                    
#: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=Soenneker.Atomics.Strings&version=4.0.18
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.Atomics.Strings&version=4.0.18
                    
Install as a Cake Tool

alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image

Soenneker.Atomics.Strings

A lock-free, thread-safe wrapper for atomically publishing and reading a string reference. Useful for shared string state and one-time (or racing) initialization without locks.

Install

dotnet add package Soenneker.Atomics.Strings

What you get

  • AtomicString — A lock-free, thread-safe wrapper for atomically publishing and reading a string reference. Useful for shared string state and one-time (or racing) initialization without locks.

API at a glance

API What it does Result / important behavior
AtomicString.Get() Returns the current value (may be null). The current value.
AtomicString.Value Returns the current value (may be null). Returns the current value (may be null).
AtomicString.HasValue Returns true when a non-null value has been published. Returns true when a non-null value has been published.
AtomicString.Exchange(value) Atomically sets the value and returns the previous value (may be null). The value that was stored before the atomic update.
AtomicString.Clear() Clears the value (sets to null) and returns the previous value (may be null). The value that was stored before the atomic update.
AtomicString.TrySet(value) Attempts to set the value only if the current value is null. Returns true if the caller won the race and published value. true if the requested update was applied; otherwise, false.
AtomicString.TrySetIfNullOrEmpty(value) Attempts to set the value only if the current value is null or empty. Returns true if the value was set by this call. true if the requested update was applied; otherwise, false.
AtomicString.CompareExchange(value, comparand) Atomically replaces the value if the current value reference equals comparand. Returns the original value (may be null). The value observed before the compare-and-exchange attempt.
AtomicString.TryCompareExchange(value, comparand) Atomically replaces the value if the current value reference equals comparand. Returns true if the exchange occurred. true if atomically replaces the value if the current value reference equals . Returns true if the exchange occurred; otherwise, false.
AtomicString.GetOrAdd(factory) Returns the current value if present; otherwise computes a value, publishes it (best-effort), and returns the published value. The current value.
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 (2)

Showing the top 2 NuGet packages that depend on Soenneker.Atomics.Strings:

Package Downloads
Soenneker.Utils.Environment

A utility library for useful environment related functionality

Soenneker.Utils.Paths.Resources

Resolves Resources directories across local, Azure, and GitHub Actions environments.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
4.0.22 25 9/15/2026
4.0.21 8,268 9/12/2026
4.0.20 64 9/12/2026
4.0.19 69,107 8/29/2026
4.0.18 105 8/29/2026
4.0.17 98 8/29/2026
4.0.16 83,595 7/28/2026
4.0.15 32,162 7/16/2026
4.0.14 46,227 6/19/2026
4.0.13 45,257 6/5/2026
4.0.12 55,574 4/22/2026
4.0.10 48,735 3/12/2026
4.0.9 274 3/12/2026
4.0.8 122 3/12/2026
4.0.7 2,876 3/12/2026
4.0.6 13,963 3/10/2026
4.0.5 4,951 3/9/2026
4.0.4 132 3/9/2026
4.0.3 1,540 3/9/2026
4.0.2 14,499 3/4/2026
Loading failed

Improve README usability and API guidance