Interlocked.Add Methode

Definition

Addiert zwei ganze Zahlen und ersetzt die erste ganze Zahl durch die Summe als atomative Operation.

Überlädt

Name Beschreibung
Add(Int32, Int32)

Addiert zwei 32-Bit-Ganzzahlen und ersetzt die erste ganzzahlige Zahl durch die Summe als atomative Operation.

Add(Int64, Int64)

Addiert zwei 64-Bit-Ganzzahlen und ersetzt die erste ganze Zahl durch die Summe als Atomoperation.

Add(UInt32, UInt32)

Addiert zwei 32-Bit-ganzzahlen ohne Vorzeichen und ersetzt die erste ganze Zahl durch die Summe, als Atomoperation.

Add(UInt64, UInt64)

Addiert zwei 64-Bit-ganzzahlen ohne Vorzeichen und ersetzt die erste ganze Zahl durch die Summe, als Atomoperation.

Add(Int32, Int32)

Quelle:
Interlocked.CoreCLR.cs
Quelle:
Interlocked.CoreCLR.cs
Quelle:
Interlocked.CoreCLR.cs
Quelle:
Interlocked.CoreCLR.cs
Quelle:
Interlocked.CoreCLR.cs

Addiert zwei 32-Bit-Ganzzahlen und ersetzt die erste ganzzahlige Zahl durch die Summe als atomative Operation.

public:
 static int Add(int % location1, int value);
public static int Add(ref int location1, int value);
static member Add : int * int -> int
Public Shared Function Add (ByRef location1 As Integer, value As Integer) As Integer

Parameter

location1
Int32

Eine Variable, die den ersten hinzuzufügenden Wert enthält. Die Summe der beiden Werte wird gespeichert in location1.

value
Int32

Der Wert, der der ganzzahligen Zahl hinzugefügt werden soll.location1

Gibt zurück

Der neue Wert, der bei location1 diesem Vorgang gespeichert wurde.

Ausnahmen

Die Adresse von location1 ist ein NULL-Zeiger.

Hinweise

Diese Methode behandelt eine Überlaufbedingung durch Umbruch: Wenn der Wert bei location1 1 ist und value 1 istInt32.MaxValue, lautet Int32.MinValuedas Ergebnis ; wenn value 2, lautet das Ergebnis ( +Int32.MinValue 1) usw. Es wird keine Ausnahme ausgelöst.

Weitere Informationen

Gilt für:

Add(Int64, Int64)

Quelle:
Interlocked.CoreCLR.cs
Quelle:
Interlocked.CoreCLR.cs
Quelle:
Interlocked.CoreCLR.cs
Quelle:
Interlocked.CoreCLR.cs
Quelle:
Interlocked.CoreCLR.cs

Addiert zwei 64-Bit-Ganzzahlen und ersetzt die erste ganze Zahl durch die Summe als Atomoperation.

public:
 static long Add(long % location1, long value);
public static long Add(ref long location1, long value);
static member Add : int64 * int64 -> int64
Public Shared Function Add (ByRef location1 As Long, value As Long) As Long

Parameter

location1
Int64

Eine Variable, die den ersten hinzuzufügenden Wert enthält. Die Summe der beiden Werte wird gespeichert in location1.

value
Int64

Der Wert, der der ganzzahligen Zahl hinzugefügt werden soll.location1

Gibt zurück

Der neue Wert, der bei location1 diesem Vorgang gespeichert wurde.

Ausnahmen

Die Adresse von location1 ist ein NULL-Zeiger.

Hinweise

Diese Methode behandelt eine Überlaufbedingung durch Umbruch: Wenn der Wert bei location1 1 ist und value 1 istInt64.MaxValue, lautet Int64.MinValuedas Ergebnis ; wenn value 2, lautet das Ergebnis ( +Int64.MinValue 1) usw. Es wird keine Ausnahme ausgelöst.

Weitere Informationen

Gilt für:

Add(UInt32, UInt32)

Quelle:
Interlocked.cs
Quelle:
Interlocked.cs
Quelle:
Interlocked.cs
Quelle:
Interlocked.cs
Quelle:
Interlocked.cs

Wichtig

Diese API ist nicht CLS-kompatibel.

Addiert zwei 32-Bit-ganzzahlen ohne Vorzeichen und ersetzt die erste ganze Zahl durch die Summe, als Atomoperation.

public:
 static System::UInt32 Add(System::UInt32 % location1, System::UInt32 value);
[System.CLSCompliant(false)]
public static uint Add(ref uint location1, uint value);
[<System.CLSCompliant(false)>]
static member Add : uint32 * uint32 -> uint32
Public Shared Function Add (ByRef location1 As UInteger, value As UInteger) As UInteger

Parameter

location1
UInt32

Eine Variable, die den ersten hinzuzufügenden Wert enthält. Die Summe der beiden Werte wird gespeichert in location1.

value
UInt32

Der Wert, der der ganzzahligen Zahl hinzugefügt werden soll.location1

Gibt zurück

Der neue Wert, der bei location1 diesem Vorgang gespeichert wurde.

Attribute

Ausnahmen

Die Adresse von location1 ist ein null Zeiger.

Gilt für:

Add(UInt64, UInt64)

Quelle:
Interlocked.cs
Quelle:
Interlocked.cs
Quelle:
Interlocked.cs
Quelle:
Interlocked.cs
Quelle:
Interlocked.cs

Wichtig

Diese API ist nicht CLS-kompatibel.

Addiert zwei 64-Bit-ganzzahlen ohne Vorzeichen und ersetzt die erste ganze Zahl durch die Summe, als Atomoperation.

public:
 static System::UInt64 Add(System::UInt64 % location1, System::UInt64 value);
[System.CLSCompliant(false)]
public static ulong Add(ref ulong location1, ulong value);
[<System.CLSCompliant(false)>]
static member Add : uint64 * uint64 -> uint64
Public Shared Function Add (ByRef location1 As ULong, value As ULong) As ULong

Parameter

location1
UInt64

Eine Variable, die den ersten hinzuzufügenden Wert enthält. Die Summe der beiden Werte wird gespeichert in location1.

value
UInt64

Der Wert, der der ganzzahligen Zahl hinzugefügt werden soll.location1

Gibt zurück

Der neue Wert, der bei location1 diesem Vorgang gespeichert wurde.

Attribute

Ausnahmen

Die Adresse von location1 ist ein null Zeiger.

Gilt für: