Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 1 addition & 22 deletions xml/System.Threading/Interlocked.xml
Original file line number Diff line number Diff line change
Expand Up @@ -954,16 +954,6 @@

## Remarks
Beginning with .NET Framework version 2.0, the <xref:System.Threading.Interlocked.Exchange%60%601%28%60%600%40%2C%60%600%29> method overload provides a type-safe alternative for reference types.



## Examples
The following code example shows the syntax for using `Exchange` with any reference type object.

[!code-cpp[System.Threading.Interlocked.Exchange#1](~/samples/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Interlocked.Exchange/CPP/source.cpp#1)]
[!code-csharp[System.Threading.Interlocked.Exchange#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Threading.Interlocked.Exchange/CS/source.cs#1)]
[!code-vb[System.Threading.Interlocked.Exchange#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Threading.Interlocked.Exchange/VB/source.vb#1)]

]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">The address of <paramref name="location1" /> is a null pointer.</exception>
Expand Down Expand Up @@ -1067,17 +1057,6 @@

> [!NOTE]
> This method overload is preferable to the <xref:System.Threading.Interlocked.Exchange%28System.Object%40%2CSystem.Object%29> method overload, because the latter requires late-bound access to the destination object .



## Examples
The following example launches ten tasks, each of which generates 100 ten-character part numbers. It then the part number that is first alphabetically.

[!code-csharp[System.Threading.Interlocked.Exchange#2](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Threading.Interlocked.Exchange/CS/Exchange5.cs#2)]
[!code-vb[System.Threading.Interlocked.Exchange#2](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Threading.Interlocked.Exchange/VB/Exchange5.vb#2)]

The example uses the `firstWidget` variable to store the ID that occurs first in the sort order. It compares each ID that it generates with the `firstWidget` value. If the new value precedes the current value of `firstWidget` in the sort order, the example calls the <xref:System.Threading.Interlocked.Exchange%2A> method to assign the new value to `firstWidget`.

]]></format>
</remarks>
<exception cref="T:System.NullReferenceException">The address of <paramref name="location1" /> is a null pointer.</exception>
Expand Down Expand Up @@ -1326,4 +1305,4 @@
</Docs>
</Member>
</Members>
</Type>
</Type>