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)

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)

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)

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)

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)

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)

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)

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)

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)

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)

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)

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)

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)

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)

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)

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

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 -> bool
Public Shared Function Read (ByRef location As Boolean) As Boolean

Parameters

location
Boolean

The field to read.

Returns

The value that was read.

Remarks

For more information, see the Volatile class.

Applies to

Read(Byte)

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

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 -> byte
Public Shared Function Read (ByRef location As Byte) As Byte

Parameters

location
Byte

The field to read.

Returns

The value that was read.

Remarks

For more information, see the Volatile class.

Applies to

Read(Double)

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

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 -> double
Public Shared Function Read (ByRef location As Double) As Double

Parameters

location
Double

The field to read.

Returns

The value that was read.

Remarks

For more information, see the Volatile class.

Applies to

Read(Int16)

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

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 -> int16
Public Shared Function Read (ByRef location As Short) As Short

Parameters

location
Int16

The field to read.

Returns

The value that was read.

Remarks

For more information, see the Volatile class.

Applies to

Read(Int32)

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

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 -> int
Public Shared Function Read (ByRef location As Integer) As Integer

Parameters

location
Int32

The field to read.

Returns

The value that was read.

Remarks

For more information, see the Volatile class.

Applies to

Read(Int64)

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

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 -> int64
Public Shared Function Read (ByRef location As Long) As Long

Parameters

location
Int64

The field to read.

Returns

The value that was read.

Remarks

For more information, see the Volatile class.

Applies to

Read(IntPtr)

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

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 -> nativeint
Public Shared Function Read (ByRef location As IntPtr) As IntPtr

Parameters

location
IntPtr

nativeint

The field to read.

Returns

IntPtr

nativeint

The value that was read.

Remarks

For more information, see the Volatile class.

Applies to

Read(SByte)

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

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);
[<System.CLSCompliant(false)>]
static member Read : sbyte -> sbyte
Public Shared Function Read (ByRef location As SByte) As SByte

Parameters

location
SByte

The field to read.

Returns

The value that was read.

Attributes

Remarks

For more information, see the Volatile class.

Applies to

Read(Single)

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

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 -> single
Public Shared Function Read (ByRef location As Single) As Single

Parameters

location
Single

The field to read.

Returns

The value that was read.

Remarks

For more information, see the Volatile class.

Applies to

Read(UInt16)

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

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);
[<System.CLSCompliant(false)>]
static member Read : uint16 -> uint16
Public Shared Function Read (ByRef location As UShort) As UShort

Parameters

location
UInt16

The field to read.

Returns

The value that was read.

Attributes

Remarks

For more information, see the Volatile class.

Applies to

Read(UInt32)

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

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);
[<System.CLSCompliant(false)>]
static member Read : uint32 -> uint32
Public Shared Function Read (ByRef location As UInteger) As UInteger

Parameters

location
UInt32

The field to read.

Returns

The value that was read.

Attributes

Remarks

For more information, see the Volatile class.

Applies to

Read(UInt64)

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

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);
[<System.CLSCompliant(false)>]
static member Read : uint64 -> uint64
Public Shared Function Read (ByRef location As ULong) As ULong

Parameters

location
UInt64

The field to read.

Returns

The value that was read.

Attributes

Remarks

For more information, see the Volatile class.

Applies to

Read(UIntPtr)

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

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);
[<System.CLSCompliant(false)>]
static member Read : unativeint -> unativeint
Public Shared Function Read (ByRef location As UIntPtr) As UIntPtr

Parameters

location
UIntPtr

unativeint

The field to read.

Returns

UIntPtr

unativeint

The value that was read.

Attributes

Remarks

For more information, see the Volatile class.

Applies to

Read<T>(T)

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

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 -> '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

The field to read.

Returns

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