Volatile.Read Volatile.Read Volatile.Read Volatile.Read Method

Definition

Reads the value of 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 after this method in the code, the processor cannot move it before this method.

Overloads

Read(Boolean) Read(Boolean) Read(Boolean) Read(Boolean)

Reads the value of 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 after this method in the code, the processor cannot move it before this method.

Read(Byte) Read(Byte) Read(Byte) Read(Byte)

Reads the value of 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 after this method in the code, the processor cannot move it before this method.

Read(Double) Read(Double) Read(Double) Read(Double)

Reads the value of 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 after this method in the code, the processor cannot move it before this method.

Read(Int16) Read(Int16) Read(Int16) Read(Int16)

Reads the value of 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 after this method in the code, the processor cannot move it before this method.

Read(Int32) Read(Int32) Read(Int32) Read(Int32)

Reads the value of 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 after this method in the code, the processor cannot move it before this method.

Read(Int64) Read(Int64) Read(Int64) Read(Int64)

Reads the value of 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 after this method in the code, the processor cannot move it before this method.

Read(IntPtr) Read(IntPtr) Read(IntPtr) Read(IntPtr)

Reads the value of 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 after this method in the code, the processor cannot move it before this method.

Read(SByte) Read(SByte) Read(SByte) Read(SByte)

Reads the value of 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 after this method in the code, the processor cannot move it before this method.

Read(Single) Read(Single) Read(Single) Read(Single)

Reads the value of 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 after this method in the code, the processor cannot move it before this method.

Read(UInt16) Read(UInt16) Read(UInt16) Read(UInt16)

Reads the value of 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 after this method in the code, the processor cannot move it before this method.

Read(UInt32) Read(UInt32) Read(UInt32) Read(UInt32)

Reads the value of 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 after this method in the code, the processor cannot move it before this method.

Read(UInt64) Read(UInt64) Read(UInt64) Read(UInt64)

Reads the value of 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 after this method in the code, the processor cannot move it before this method.

Read(UIntPtr) Read(UIntPtr) Read(UIntPtr) Read(UIntPtr)

Reads the value of 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 after this method in the code, the processor cannot move it before this method.

Read<T>(T) Read<T>(T) Read<T>(T) Read<T>(T)

Reads the object reference from 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 after this method in the code, the processor cannot move it before this method.

Read(Boolean) Read(Boolean) Read(Boolean) Read(Boolean)

Reads the value of 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 after this method in the code, the processor cannot move it before this method.

public:
 static bool Read(bool % location);
public static bool Read (ref bool location);
static member Read :  -> bool
Public Shared Function Read (ByRef location As Boolean) As Boolean

Parameters

location
Boolean Boolean Boolean Boolean

The field to read.

Returns

The value that was read. This value is the latest written by any processor in the computer, regardless of the number of processors or the state of processor cache.

Remarks

For more information, see the Volatile class.

Read(Byte) Read(Byte) Read(Byte) Read(Byte)

Reads the value of 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 after this method in the code, the processor cannot move it before this method.

public:
 static System::Byte Read(System::Byte % location);
public static byte Read (ref byte location);
static member Read :  -> byte
Public Shared Function Read (ByRef location As Byte) As Byte

Parameters

location
Byte Byte Byte Byte

The field to read.

Returns

The value that was read. This value is the latest written by any processor in the computer, regardless of the number of processors or the state of processor cache.

Remarks

For more information, see the Volatile class.

Read(Double) Read(Double) Read(Double) Read(Double)

Reads the value of 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 after this method in the code, the processor cannot move it before this method.

public:
 static double Read(double % location);
public static double Read (ref double location);
static member Read :  -> double
Public Shared Function Read (ByRef location As Double) As Double

Parameters

location
Double Double Double Double

The field to read.

Returns

The value that was read. This value is the latest written by any processor in the computer, regardless of the number of processors or the state of processor cache.

Remarks

For more information, see the Volatile class.

Read(Int16) Read(Int16) Read(Int16) Read(Int16)

Reads the value of 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 after this method in the code, the processor cannot move it before this method.

public:
 static short Read(short % location);
public static short Read (ref short location);
static member Read :  -> int16
Public Shared Function Read (ByRef location As Short) As Short

Parameters

location
Int16 Int16 Int16 Int16

The field to read.

Returns

The value that was read. This value is the latest written by any processor in the computer, regardless of the number of processors or the state of processor cache.

Remarks

For more information, see the Volatile class.

Read(Int32) Read(Int32) Read(Int32) Read(Int32)

Reads the value of 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 after this method in the code, the processor cannot move it before this method.

public:
 static int Read(int % location);
public static int Read (ref int location);
static member Read :  -> int
Public Shared Function Read (ByRef location As Integer) As Integer

Parameters

location
Int32 Int32 Int32 Int32

The field to read.

Returns

The value that was read. This value is the latest written by any processor in the computer, regardless of the number of processors or the state of processor cache.

Remarks

For more information, see the Volatile class.

Read(Int64) Read(Int64) Read(Int64) Read(Int64)

Reads the value of 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 after this method in the code, the processor cannot move it before this method.

public:
 static long Read(long % location);
public static long Read (ref long location);
static member Read :  -> int64
Public Shared Function Read (ByRef location As Long) As Long

Parameters

location
Int64 Int64 Int64 Int64

The field to read.

Returns

The value that was read. This value is the latest written by any processor in the computer, regardless of the number of processors or the state of processor cache.

Remarks

For more information, see the Volatile class.

Read(IntPtr) Read(IntPtr) Read(IntPtr) Read(IntPtr)

Reads the value of 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 after this method in the code, the processor cannot move it before this method.

public:
 static IntPtr Read(IntPtr % location);
public static IntPtr Read (ref IntPtr location);
static member Read :  -> nativeint
Public Shared Function Read (ByRef location As IntPtr) As IntPtr

Parameters

location
IntPtr IntPtr IntPtr IntPtr

The field to read.

Returns

The value that was read. This value is the latest written by any processor in the computer, regardless of the number of processors or the state of processor cache.

Remarks

For more information, see the Volatile class.

Read(SByte) Read(SByte) Read(SByte) Read(SByte)

Important

This API is not CLS-compliant.

Reads the value of 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 after this method in the code, the processor cannot move it before this method.

public:
 static System::SByte Read(System::SByte % location);
[System.CLSCompliant(false)]
public static sbyte Read (ref sbyte location);
static member Read :  -> sbyte
Public Shared Function Read (ByRef location As SByte) As SByte

Parameters

location
SByte SByte SByte SByte

The field to read.

Returns

The value that was read. This value is the latest written by any processor in the computer, regardless of the number of processors or the state of processor cache.

Remarks

For more information, see the Volatile class.

Read(Single) Read(Single) Read(Single) Read(Single)

Reads the value of 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 after this method in the code, the processor cannot move it before this method.

public:
 static float Read(float % location);
public static float Read (ref float location);
static member Read :  -> single
Public Shared Function Read (ByRef location As Single) As Single

Parameters

location
Single Single Single Single

The field to read.

Returns

The value that was read. This value is the latest written by any processor in the computer, regardless of the number of processors or the state of processor cache.

Remarks

For more information, see the Volatile class.

Read(UInt16) Read(UInt16) Read(UInt16) Read(UInt16)

Important

This API is not CLS-compliant.

CLS-compliant alternative
System.Threading.Volatile.Read(Int16)

Reads the value of 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 after this method in the code, the processor cannot move it before this method.

public:
 static System::UInt16 Read(System::UInt16 % location);
[System.CLSCompliant(false)]
public static ushort Read (ref ushort location);
static member Read :  -> uint16
Public Shared Function Read (ByRef location As UShort) As UShort

Parameters

location
UInt16 UInt16 UInt16 UInt16

The field to read.

Returns

The value that was read. This value is the latest written by any processor in the computer, regardless of the number of processors or the state of processor cache.

Remarks

For more information, see the Volatile class.

Read(UInt32) Read(UInt32) Read(UInt32) Read(UInt32)

Important

This API is not CLS-compliant.

CLS-compliant alternative
System.Threading.Volatile.Read(Int32)

Reads the value of 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 after this method in the code, the processor cannot move it before this method.

public:
 static System::UInt32 Read(System::UInt32 % location);
[System.CLSCompliant(false)]
public static uint Read (ref uint location);
static member Read :  -> uint32
Public Shared Function Read (ByRef location As UInteger) As UInteger

Parameters

location
UInt32 UInt32 UInt32 UInt32

The field to read.

Returns

The value that was read. This value is the latest written by any processor in the computer, regardless of the number of processors or the state of processor cache.

Remarks

For more information, see the Volatile class.

Read(UInt64) Read(UInt64) Read(UInt64) Read(UInt64)

Important

This API is not CLS-compliant.

CLS-compliant alternative
System.Threading.Volatile.Read(Int64)

Reads the value of 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 after this method in the code, the processor cannot move it before this method.

public:
 static System::UInt64 Read(System::UInt64 % location);
[System.CLSCompliant(false)]
public static ulong Read (ref ulong location);
static member Read :  -> uint64
Public Shared Function Read (ByRef location As ULong) As ULong

Parameters

location
UInt64 UInt64 UInt64 UInt64

The field to read.

Returns

The value that was read. This value is the latest written by any processor in the computer, regardless of the number of processors or the state of processor cache.

Remarks

For more information, see the Volatile class.

Read(UIntPtr) Read(UIntPtr) Read(UIntPtr) Read(UIntPtr)

Important

This API is not CLS-compliant.

CLS-compliant alternative
System.Threading.Volatile.Read(IntPtr)

Reads the value of 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 after this method in the code, the processor cannot move it before this method.

public:
 static UIntPtr Read(UIntPtr % location);
[System.CLSCompliant(false)]
public static UIntPtr Read (ref UIntPtr location);
static member Read :  -> unativeint
Public Shared Function Read (ByRef location As UIntPtr) As UIntPtr

Parameters

location
UIntPtr UIntPtr UIntPtr UIntPtr

The field to read.

Returns

The value that was read. This value is the latest written by any processor in the computer, regardless of the number of processors or the state of processor cache.

Remarks

For more information, see the Volatile class.

Read<T>(T) Read<T>(T) Read<T>(T) Read<T>(T)

Reads the object reference from 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 after this method in the code, the processor cannot move it before this method.

public:
generic <typename T>
 where T : class static T Read(T % location);
public static T Read<T> (ref T location) where T : class;
static member Read :  -> 'T (requires 'T : null)
Public Shared Function Read(Of T As Class) (ByRef location As T) As T

Type Parameters

T

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

Parameters

location
T T T T

The field to read.

Returns

T T T T

The reference to T that was read. This reference is the latest written by any processor in the computer, regardless of the number of processors or the state of processor cache.

Remarks

For more information, see the Volatile class.

Applies to