Interlocked.And Method

Definition

Overloads

And(Int32, Int32)

Bitwise "ands" two 32-bit signed integers and replaces the first integer with the result, as an atomic operation.

And(Int64, Int64)

Bitwise "ands" two 64-bit signed integers and replaces the first integer with the result, as an atomic operation.

And(UInt32, UInt32)

Bitwise "ands" two 32-bit unsigned integers and replaces the first integer with the result, as an atomic operation.

And(UInt64, UInt64)

Bitwise "ands" two 64-bit unsigned integers and replaces the first integer with the result, as an atomic operation.

And(Int32, Int32)

Source:
Interlocked.cs
Source:
Interlocked.cs
Source:
Interlocked.cs

Bitwise "ands" two 32-bit signed integers and replaces the first integer with the result, as an atomic operation.

C#
public static int And(ref int location1, int value);

Parameters

location1
Int32

A variable containing the first value to be combined. The result is stored in location1.

value
Int32

The value to be combined with the integer at location1.

Returns

The original value in location1.

Exceptions

The address of location1 is a null pointer.

Applies to

.NET 10 and other versions
Product Versions
.NET 5, 6, 7, 8, 9, 10

And(Int64, Int64)

Source:
Interlocked.cs
Source:
Interlocked.cs
Source:
Interlocked.cs

Bitwise "ands" two 64-bit signed integers and replaces the first integer with the result, as an atomic operation.

C#
public static long And(ref long location1, long value);

Parameters

location1
Int64

A variable containing the first value to be combined. The result is stored in location1.

value
Int64

The value to be combined with the integer at location1.

Returns

The original value in location1.

Exceptions

The address of location1 is a null pointer.

Applies to

.NET 10 and other versions
Product Versions
.NET 5, 6, 7, 8, 9, 10

And(UInt32, UInt32)

Source:
Interlocked.cs
Source:
Interlocked.cs
Source:
Interlocked.cs

Important

This API is not CLS-compliant.

Bitwise "ands" two 32-bit unsigned integers and replaces the first integer with the result, as an atomic operation.

C#
[System.CLSCompliant(false)]
public static uint And(ref uint location1, uint value);

Parameters

location1
UInt32

A variable containing the first value to be combined. The result is stored in location1.

value
UInt32

The value to be combined with the integer at location1.

Returns

The original value in location1.

Attributes

Exceptions

The address of location1 is a null pointer.

Applies to

.NET 10 and other versions
Product Versions
.NET 5, 6, 7, 8, 9, 10

And(UInt64, UInt64)

Source:
Interlocked.cs
Source:
Interlocked.cs
Source:
Interlocked.cs

Important

This API is not CLS-compliant.

Bitwise "ands" two 64-bit unsigned integers and replaces the first integer with the result, as an atomic operation.

C#
[System.CLSCompliant(false)]
public static ulong And(ref ulong location1, ulong value);

Parameters

location1
UInt64

A variable containing the first value to be combined. The result is stored in location1.

value
UInt64

The value to be combined with the integer at location1.

Returns

The original value in location1.

Attributes

Exceptions

The address of location1 is a null pointer.

Applies to

.NET 10 and other versions
Product Versions
.NET 5, 6, 7, 8, 9, 10