API

Interlocked.CompareExchange

Conditionally exchanges and returns the old value.

Formal Syntax & Structure

csharp syntaxcsharp
Interlocked.CompareExchange(ref count, 10, 8)

Working Example

Example Snippetcsharp
// Documentary fragment; see linked lesson for context.Interlocked.CompareExchange(ref count, 10, 8)
C# & .NET Reference