Volatile.Write Volatile.Write Volatile.Write Volatile.Write Method

Definition

Writes a value to a field. On systems that require it, inserts a memory barrier that prevents the processor from reordering memory operations as follows: If a read or write appears before this method in the code, the processor cannot move it after this method.

Overloads

Write(Boolean, Boolean) Write(Boolean, Boolean) Write(Boolean, Boolean) Write(Boolean, Boolean)

Writes the specified value to the specified field. On systems that require it, inserts a memory barrier that prevents the processor from reordering memory operations as follows: If a read or write appears before this method in the code, the processor cannot move it after this method.

Write(Byte, Byte) Write(Byte, Byte) Write(Byte, Byte) Write(Byte, Byte)

Writes the specified value to the specified field. On systems that require it, inserts a memory barrier that prevents the processor from reordering memory operations as follows: If a read or write appears before this method in the code, the processor cannot move it after this method.

Write(Double, Double) Write(Double, Double) Write(Double, Double) Write(Double, Double)

Writes the specified value to the specified field. On systems that require it, inserts a memory barrier that prevents the processor from reordering memory operations as follows: If a read or write appears before this method in the code, the processor cannot move it after this method.

Write(Int16, Int16) Write(Int16, Int16) Write(Int16, Int16) Write(Int16, Int16)

Writes the specified value to the specified field. On systems that require it, inserts a memory barrier that prevents the processor from reordering memory operations as follows: If a read or write appears before this method in the code, the processor cannot move it after this method.

Write(Int32, Int32) Write(Int32, Int32) Write(Int32, Int32) Write(Int32, Int32)

Writes the specified value to the specified field. On systems that require it, inserts a memory barrier that prevents the processor from reordering memory operations as follows: If a read or write appears before this method in the code, the processor cannot move it after this method.

Write(Int64, Int64) Write(Int64, Int64) Write(Int64, Int64) Write(Int64, Int64)

Writes the specified value to the specified field. On systems that require it, inserts a memory barrier that prevents the processor from reordering memory operations as follows: If a read or write appears before this method in the code, the processor cannot move it after this method.

Write(IntPtr, IntPtr) Write(IntPtr, IntPtr) Write(IntPtr, IntPtr) Write(IntPtr, IntPtr)

Writes the specified value to the specified field. On systems that require it, inserts a memory barrier that prevents the processor from reordering memory operations as follows: If a read or write appears before this method in the code, the processor cannot move it after this method.

Write(SByte, SByte) Write(SByte, SByte) Write(SByte, SByte) Write(SByte, SByte)

Writes the specified value to the specified field. On systems that require it, inserts a memory barrier that prevents the processor from reordering memory operations as follows: If a read or write appears before this method in the code, the processor cannot move it after this method.

Write(Single, Single) Write(Single, Single) Write(Single, Single) Write(Single, Single)

Writes the specified value to the specified field. On systems that require it, inserts a memory barrier that prevents the processor from reordering memory operations as follows: If a read or write appears before this method in the code, the processor cannot move it after this method.

Write(UInt16, UInt16) Write(UInt16, UInt16) Write(UInt16, UInt16) Write(UInt16, UInt16)

Writes the specified value to the specified field. On systems that require it, inserts a memory barrier that prevents the processor from reordering memory operations as follows: If a read or write appears before this method in the code, the processor cannot move it after this method.

Write(UInt32, UInt32) Write(UInt32, UInt32) Write(UInt32, UInt32) Write(UInt32, UInt32)

Writes the specified value to the specified field. On systems that require it, inserts a memory barrier that prevents the processor from reordering memory operations as follows: If a read or write appears before this method in the code, the processor cannot move it after this method.

Write(UInt64, UInt64) Write(UInt64, UInt64) Write(UInt64, UInt64) Write(UInt64, UInt64)

Writes the specified value to the specified field. On systems that require it, inserts a memory barrier that prevents the processor from reordering memory operations as follows: If a read or write appears before this method in the code, the processor cannot move it after this method.

Write(UIntPtr, UIntPtr) Write(UIntPtr, UIntPtr) Write(UIntPtr, UIntPtr) Write(UIntPtr, UIntPtr)

Writes the specified value to the specified field. On systems that require it, inserts a memory barrier that prevents the processor from reordering memory operations as follows: If a read or write appears before this method in the code, the processor cannot move it after this method.

Write<T>(T, T) Write<T>(T, T) Write<T>(T, T) Write<T>(T, T)

Writes the specified object reference to the specified field. On systems that require it, inserts a memory barrier that prevents the processor from reordering memory operations as follows: If a read or write appears before this method in the code, the processor cannot move it after this method.

Write(Boolean, Boolean) Write(Boolean, Boolean) Write(Boolean, Boolean) Write(Boolean, Boolean)

Writes the specified value to the specified field. On systems that require it, inserts a memory barrier that prevents the processor from reordering memory operations as follows: If a read or write appears before this method in the code, the processor cannot move it after this method.

public:
 static void Write(bool % location, bool value);
public static void Write (ref bool location, bool value);
static member Write : bool * bool -> unit
Public Shared Sub Write (ByRef location As Boolean, value As Boolean)

Parameters

location
Boolean Boolean Boolean Boolean

The field where the value is written.

value
Boolean Boolean Boolean Boolean

The value to write. The value is written immediately so that it is visible to all processors in the computer.

Remarks

For more information, see the Volatile class.

Write(Byte, Byte) Write(Byte, Byte) Write(Byte, Byte) Write(Byte, Byte)

Writes the specified value to the specified field. On systems that require it, inserts a memory barrier that prevents the processor from reordering memory operations as follows: If a read or write appears before this method in the code, the processor cannot move it after this method.

public:
 static void Write(System::Byte % location, System::Byte value);
public static void Write (ref byte location, byte value);
static member Write : byte * byte -> unit
Public Shared Sub Write (ByRef location As Byte, value As Byte)

Parameters

location
Byte Byte Byte Byte

The field where the value is written.

value
Byte Byte Byte Byte

The value to write. The value is written immediately so that it is visible to all processors in the computer.

Remarks

For more information, see the Volatile class.

Write(Double, Double) Write(Double, Double) Write(Double, Double) Write(Double, Double)

Writes the specified value to the specified field. On systems that require it, inserts a memory barrier that prevents the processor from reordering memory operations as follows: If a read or write appears before this method in the code, the processor cannot move it after this method.

public:
 static void Write(double % location, double value);
public static void Write (ref double location, double value);
static member Write : double * double -> unit
Public Shared Sub Write (ByRef location As Double, value As Double)

Parameters

location
Double Double Double Double

The field where the value is written.

value
Double Double Double Double

The value to write. The value is written immediately so that it is visible to all processors in the computer.

Remarks

For more information, see the Volatile class.

Write(Int16, Int16) Write(Int16, Int16) Write(Int16, Int16) Write(Int16, Int16)

Writes the specified value to the specified field. On systems that require it, inserts a memory barrier that prevents the processor from reordering memory operations as follows: If a read or write appears before this method in the code, the processor cannot move it after this method.

public:
 static void Write(short % location, short value);
public static void Write (ref short location, short value);
static member Write : int16 * int16 -> unit
Public Shared Sub Write (ByRef location As Short, value As Short)

Parameters

location
Int16 Int16 Int16 Int16

The field where the value is written.

value
Int16 Int16 Int16 Int16

The value to write. The value is written immediately so that it is visible to all processors in the computer.

Remarks

For more information, see the Volatile class.

Write(Int32, Int32) Write(Int32, Int32) Write(Int32, Int32) Write(Int32, Int32)

Writes the specified value to the specified field. On systems that require it, inserts a memory barrier that prevents the processor from reordering memory operations as follows: If a read or write appears before this method in the code, the processor cannot move it after this method.

public:
 static void Write(int % location, int value);
public static void Write (ref int location, int value);
static member Write : int * int -> unit
Public Shared Sub Write (ByRef location As Integer, value As Integer)

Parameters

location
Int32 Int32 Int32 Int32

The field where the value is written.

value
Int32 Int32 Int32 Int32

The value to write. The value is written immediately so that it is visible to all processors in the computer.

Remarks

For more information, see the Volatile class.

Write(Int64, Int64) Write(Int64, Int64) Write(Int64, Int64) Write(Int64, Int64)

Writes the specified value to the specified field. On systems that require it, inserts a memory barrier that prevents the processor from reordering memory operations as follows: If a read or write appears before this method in the code, the processor cannot move it after this method.

public:
 static void Write(long % location, long value);
public static void Write (ref long location, long value);
static member Write : int64 * int64 -> unit
Public Shared Sub Write (ByRef location As Long, value As Long)

Parameters

location
Int64 Int64 Int64 Int64

The field where the value is written.

value
Int64 Int64 Int64 Int64

The value to write. The value is written immediately so that it is visible to all processors in the computer.

Remarks

For more information, see the Volatile class.

Write(IntPtr, IntPtr) Write(IntPtr, IntPtr) Write(IntPtr, IntPtr) Write(IntPtr, IntPtr)

Writes the specified value to the specified field. On systems that require it, inserts a memory barrier that prevents the processor from reordering memory operations as follows: If a read or write appears before this method in the code, the processor cannot move it after this method.

public:
 static void Write(IntPtr % location, IntPtr value);
public static void Write (ref IntPtr location, IntPtr value);
static member Write : nativeint * nativeint -> unit
Public Shared Sub Write (ByRef location As IntPtr, value As IntPtr)

Parameters

location
IntPtr IntPtr IntPtr IntPtr

The field where the value is written.

value
IntPtr IntPtr IntPtr IntPtr

The value to write. The value is written immediately so that it is visible to all processors in the computer.

Remarks

For more information, see the Volatile class.

Write(SByte, SByte) Write(SByte, SByte) Write(SByte, SByte) Write(SByte, SByte)

Important

This API is not CLS-compliant.

Writes the specified value to the specified field. On systems that require it, inserts a memory barrier that prevents the processor from reordering memory operations as follows: If a read or write appears before this method in the code, the processor cannot move it after this method.

public:
 static void Write(System::SByte % location, System::SByte value);
[System.CLSCompliant(false)]
public static void Write (ref sbyte location, sbyte value);
static member Write : sbyte * sbyte -> unit
Public Shared Sub Write (ByRef location As SByte, value As SByte)

Parameters

location
SByte SByte SByte SByte

The field where the value is written.

value
SByte SByte SByte SByte

The value to write. The value is written immediately so that it is visible to all processors in the computer.

Remarks

For more information, see the Volatile class.

Write(Single, Single) Write(Single, Single) Write(Single, Single) Write(Single, Single)

Writes the specified value to the specified field. On systems that require it, inserts a memory barrier that prevents the processor from reordering memory operations as follows: If a read or write appears before this method in the code, the processor cannot move it after this method.

public:
 static void Write(float % location, float value);
public static void Write (ref float location, float value);
static member Write : single * single -> unit
Public Shared Sub Write (ByRef location As Single, value As Single)

Parameters

location
Single Single Single Single

The field where the value is written.

value
Single Single Single Single

The value to write. The value is written immediately so that it is visible to all processors in the computer.

Remarks

For more information, see the Volatile class.

Write(UInt16, UInt16) Write(UInt16, UInt16) Write(UInt16, UInt16) Write(UInt16, UInt16)

Important

This API is not CLS-compliant.

CLS-compliant alternative
System.Threading.Volatile.Write(Int16, Int16)

Writes the specified value to the specified field. On systems that require it, inserts a memory barrier that prevents the processor from reordering memory operations as follows: If a read or write appears before this method in the code, the processor cannot move it after this method.

public:
 static void Write(System::UInt16 % location, System::UInt16 value);
[System.CLSCompliant(false)]
public static void Write (ref ushort location, ushort value);
static member Write : uint16 * uint16 -> unit
Public Shared Sub Write (ByRef location As UShort, value As UShort)

Parameters

location
UInt16 UInt16 UInt16 UInt16

The field where the value is written.

value
UInt16 UInt16 UInt16 UInt16

The value to write. The value is written immediately so that it is visible to all processors in the computer.

Remarks

For more information, see the Volatile class.

Write(UInt32, UInt32) Write(UInt32, UInt32) Write(UInt32, UInt32) Write(UInt32, UInt32)

Important

This API is not CLS-compliant.

CLS-compliant alternative
System.Threading.Volatile.Write(Int32, Int32)

Writes the specified value to the specified field. On systems that require it, inserts a memory barrier that prevents the processor from reordering memory operations as follows: If a read or write appears before this method in the code, the processor cannot move it after this method.

public:
 static void Write(System::UInt32 % location, System::UInt32 value);
[System.CLSCompliant(false)]
public static void Write (ref uint location, uint value);
static member Write : uint32 * uint32 -> unit
Public Shared Sub Write (ByRef location As UInteger, value As UInteger)

Parameters

location
UInt32 UInt32 UInt32 UInt32

The field where the value is written.

value
UInt32 UInt32 UInt32 UInt32

The value to write. The value is written immediately so that it is visible to all processors in the computer.

Remarks

For more information, see the Volatile class.

Write(UInt64, UInt64) Write(UInt64, UInt64) Write(UInt64, UInt64) Write(UInt64, UInt64)

Important

This API is not CLS-compliant.

CLS-compliant alternative
System.Threading.Volatile.Write(Int64, Int64)

Writes the specified value to the specified field. On systems that require it, inserts a memory barrier that prevents the processor from reordering memory operations as follows: If a read or write appears before this method in the code, the processor cannot move it after this method.

public:
 static void Write(System::UInt64 % location, System::UInt64 value);
[System.CLSCompliant(false)]
public static void Write (ref ulong location, ulong value);
static member Write : uint64 * uint64 -> unit
Public Shared Sub Write (ByRef location As ULong, value As ULong)

Parameters

location
UInt64 UInt64 UInt64 UInt64

The field where the value is written.

value
UInt64 UInt64 UInt64 UInt64

The value to write. The value is written immediately so that it is visible to all processors in the computer.

Remarks

For more information, see the Volatile class.

Write(UIntPtr, UIntPtr) Write(UIntPtr, UIntPtr) Write(UIntPtr, UIntPtr) Write(UIntPtr, UIntPtr)

Important

This API is not CLS-compliant.

CLS-compliant alternative
System.Threading.Volatile.Write(IntPtr, IntPtr)

Writes the specified value to the specified field. On systems that require it, inserts a memory barrier that prevents the processor from reordering memory operations as follows: If a read or write appears before this method in the code, the processor cannot move it after this method.

public:
 static void Write(UIntPtr % location, UIntPtr value);
[System.CLSCompliant(false)]
public static void Write (ref UIntPtr location, UIntPtr value);
static member Write : unativeint * unativeint -> unit
Public Shared Sub Write (ByRef location As UIntPtr, value As UIntPtr)

Parameters

location
UIntPtr UIntPtr UIntPtr UIntPtr

The field where the value is written.

value
UIntPtr UIntPtr UIntPtr UIntPtr

The value to write. The value is written immediately so that it is visible to all processors in the computer.

Remarks

For more information, see the Volatile class.

Write<T>(T, T) Write<T>(T, T) Write<T>(T, T) Write<T>(T, T)

Writes the specified object reference to the specified field. On systems that require it, inserts a memory barrier that prevents the processor from reordering memory operations as follows: If a read or write appears before this method in the code, the processor cannot move it after this method.

public:
generic <typename T>
 where T : class static void Write(T % location, T value);
public static void Write<T> (ref T location, T value) where T : class;
static member Write : 'T * 'T -> unit (requires 'T : null)
Public Shared Sub Write(Of T As Class) (ByRef location As T, value As T)

Type Parameters

T

The type of field to write. This must be a reference type, not a value type.

Parameters

location
T T T T

The field where the object reference is written.

value
T T T T

The object reference to write. The reference is written immediately so that it is visible to all processors in the computer.

Remarks

For more information, see the Volatile class.

Applies to