Volatile.Read Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
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
- 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
- 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
- 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
- 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
- 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
- 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
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
- 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
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.