Edit

Share via


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)

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)

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)

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)

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)

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)

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)

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)

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)

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)

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)

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)

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)

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)

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)

Source:
Volatile.cs
Source:
Volatile.cs
Source:
Volatile.cs
Source:
Volatile.cs

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

The field where the value is written.

value
Boolean

The value to write.

Remarks

For more information, see the Volatile class.

Applies to

Write(Byte, Byte)

Source:
Volatile.cs
Source:
Volatile.cs
Source:
Volatile.cs
Source:
Volatile.cs

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

The field where the value is written.

value
Byte

The value to write.

Remarks

For more information, see the Volatile class.

Applies to

Write(Double, Double)

Source:
Volatile.cs
Source:
Volatile.cs
Source:
Volatile.cs
Source:
Volatile.cs

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

The field where the value is written.

value
Double

The value to write.

Remarks

For more information, see the Volatile class.

Applies to

Write(Int16, Int16)

Source:
Volatile.cs
Source:
Volatile.cs
Source:
Volatile.cs
Source:
Volatile.cs

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

The field where the value is written.

value
Int16

The value to write.

Remarks

For more information, see the Volatile class.

Applies to

Write(Int32, Int32)

Source:
Volatile.cs
Source:
Volatile.cs
Source:
Volatile.cs
Source:
Volatile.cs

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

The field where the value is written.

value
Int32

The value to write.

Remarks

For more information, see the Volatile class.

Applies to

Write(Int64, Int64)

Source:
Volatile.cs
Source:
Volatile.cs
Source:
Volatile.cs
Source:
Volatile.cs

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

The field where the value is written.

value
Int64

The value to write.

Remarks

For more information, see the Volatile class.

Applies to

Write(IntPtr, IntPtr)

Source:
Volatile.cs
Source:
Volatile.cs
Source:
Volatile.cs
Source:
Volatile.cs

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

nativeint

The field where the value is written.

value
IntPtr

nativeint

The value to write.

Remarks

For more information, see the Volatile class.

Applies to

Write(SByte, SByte)

Source:
Volatile.cs
Source:
Volatile.cs
Source:
Volatile.cs
Source:
Volatile.cs

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);
[<System.CLSCompliant(false)>]
static member Write : sbyte * sbyte -> unit
Public Shared Sub Write (ByRef ___location As SByte, value As SByte)

Parameters

___location
SByte

The field where the value is written.

value
SByte

The value to write.

Attributes

Remarks

For more information, see the Volatile class.

Applies to

Write(Single, Single)

Source:
Volatile.cs
Source:
Volatile.cs
Source:
Volatile.cs
Source:
Volatile.cs

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

The field where the value is written.

value
Single

The value to write.

Remarks

For more information, see the Volatile class.

Applies to

Write(UInt16, UInt16)

Source:
Volatile.cs
Source:
Volatile.cs
Source:
Volatile.cs
Source:
Volatile.cs

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);
[<System.CLSCompliant(false)>]
static member Write : uint16 * uint16 -> unit
Public Shared Sub Write (ByRef ___location As UShort, value As UShort)

Parameters

___location
UInt16

The field where the value is written.

value
UInt16

The value to write.

Attributes

Remarks

For more information, see the Volatile class.

Applies to

Write(UInt32, UInt32)

Source:
Volatile.cs
Source:
Volatile.cs
Source:
Volatile.cs
Source:
Volatile.cs

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);
[<System.CLSCompliant(false)>]
static member Write : uint32 * uint32 -> unit
Public Shared Sub Write (ByRef ___location As UInteger, value As UInteger)

Parameters

___location
UInt32

The field where the value is written.

value
UInt32

The value to write.

Attributes

Remarks

For more information, see the Volatile class.

Applies to

Write(UInt64, UInt64)

Source:
Volatile.cs
Source:
Volatile.cs
Source:
Volatile.cs
Source:
Volatile.cs

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);
[<System.CLSCompliant(false)>]
static member Write : uint64 * uint64 -> unit
Public Shared Sub Write (ByRef ___location As ULong, value As ULong)

Parameters

___location
UInt64

The field where the value is written.

value
UInt64

The value to write.

Attributes

Remarks

For more information, see the Volatile class.

Applies to

Write(UIntPtr, UIntPtr)

Source:
Volatile.cs
Source:
Volatile.cs
Source:
Volatile.cs
Source:
Volatile.cs

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);
[<System.CLSCompliant(false)>]
static member Write : unativeint * unativeint -> unit
Public Shared Sub Write (ByRef ___location As UIntPtr, value As UIntPtr)

Parameters

___location
UIntPtr

unativeint

The field where the value is written.

value
UIntPtr

unativeint

The value to write.

Attributes

Remarks

For more information, see the Volatile class.

Applies to

Write<T>(T, T)

Source:
Volatile.cs
Source:
Volatile.cs
Source:
Volatile.cs
Source:
Volatile.cs

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

The field where the object reference is written.

value
T

The object reference to write.

Remarks

For more information, see the Volatile class.

Applies to