Description
Type of issue
Outdated article
Description
The summary for the generic version of CompareExchange<T>
states: "Compares two instances of the specified reference type T for reference equality..." but that is no longer true as of .NET 9. Specifically, the class constraint was removed in .NET 9 so that a reference to a primitive value type (like bool/enum) can be passed into the method. See dotnet/runtime#104558 for the pull request where the change was made.
Exchange<T>
was also changed as part of the same pull request, but the documentation only says "a variable of the specified type" and doesn't mention reference types so it's presumably correct.
Page URL
Content source URL
https://github.com/dotnet/dotnet-api-docs/blob/main/xml/System.Threading/Interlocked.xml
Document Version Independent Id
9651cd4a-a520-66e4-8303-4eb5e62f6d81
Platform Id
3ad985f3-bce2-d418-b37e-27815da4a1d4