Redigera

Dela 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

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

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

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

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

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

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

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

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

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

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

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

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

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

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