Thread.VolatileRead 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

VolatileRead(SByte)
Obsolete.

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.

VolatileRead(Single)
Obsolete.

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.

VolatileRead(UInt64)
Obsolete.

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.

VolatileRead(UInt32)
Obsolete.

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.

VolatileRead(Object)
Obsolete.

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.

VolatileRead(UIntPtr)
Obsolete.

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.

VolatileRead(UInt16)
Obsolete.

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.

VolatileRead(Int64)
Obsolete.

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.

VolatileRead(IntPtr)
Obsolete.

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.

VolatileRead(Int16)
Obsolete.

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.

VolatileRead(Double)
Obsolete.

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.

VolatileRead(Byte)
Obsolete.

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.

VolatileRead(Int32)
Obsolete.

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.

VolatileRead(SByte)

Source:
Thread.cs
Source:
Thread.cs
Source:
Thread.cs

Caution

Thread.VolatileRead and Thread.VolatileWrite are obsolete. Use Volatile.Read or Volatile.Write respectively instead.

Important

This API is not CLS-compliant.

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.

C#
[System.CLSCompliant(false)]
[System.Obsolete("Thread.VolatileRead and Thread.VolatileWrite are obsolete. Use Volatile.Read or Volatile.Write respectively instead.", DiagnosticId="SYSLIB0054", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public static sbyte VolatileRead(ref sbyte address);
C#
[System.CLSCompliant(false)]
public static sbyte VolatileRead(ref sbyte address);

Parameters

address
SByte

The field to be read.

Returns

The value that was read.

Attributes

Remarks

Thread.VolatileRead and Thread.VolatileWrite are legacy APIs and have been replaced by Volatile.Read and Volatile.Write. See the Volatile class for more information.

Applies to

.NET 10 and other versions
Product Versions (Obsolete)
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8 (9, 10)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1

VolatileRead(Single)

Source:
Thread.cs
Source:
Thread.cs
Source:
Thread.cs

Caution

Thread.VolatileRead and Thread.VolatileWrite are obsolete. Use Volatile.Read or Volatile.Write respectively instead.

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.

C#
[System.Obsolete("Thread.VolatileRead and Thread.VolatileWrite are obsolete. Use Volatile.Read or Volatile.Write respectively instead.", DiagnosticId="SYSLIB0054", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public static float VolatileRead(ref float address);
C#
public static float VolatileRead(ref float address);

Parameters

address
Single

The field to be read.

Returns

The value that was read.

Attributes

Remarks

Thread.VolatileRead and Thread.VolatileWrite are legacy APIs and have been replaced by Volatile.Read and Volatile.Write. See the Volatile class for more information.

Applies to

.NET 10 and other versions
Product Versions (Obsolete)
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8 (9, 10)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1

VolatileRead(UInt64)

Source:
Thread.cs
Source:
Thread.cs
Source:
Thread.cs

Caution

Thread.VolatileRead and Thread.VolatileWrite are obsolete. Use Volatile.Read or Volatile.Write respectively instead.

Important

This API is not CLS-compliant.

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.

C#
[System.CLSCompliant(false)]
[System.Obsolete("Thread.VolatileRead and Thread.VolatileWrite are obsolete. Use Volatile.Read or Volatile.Write respectively instead.", DiagnosticId="SYSLIB0054", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public static ulong VolatileRead(ref ulong address);
C#
[System.CLSCompliant(false)]
public static ulong VolatileRead(ref ulong address);

Parameters

address
UInt64

The field to be read.

Returns

The value that was read.

Attributes

Remarks

Thread.VolatileRead and Thread.VolatileWrite are legacy APIs and have been replaced by Volatile.Read and Volatile.Write. See the Volatile class for more information.

Applies to

.NET 10 and other versions
Product Versions (Obsolete)
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8 (9, 10)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1

VolatileRead(UInt32)

Source:
Thread.cs
Source:
Thread.cs
Source:
Thread.cs

Caution

Thread.VolatileRead and Thread.VolatileWrite are obsolete. Use Volatile.Read or Volatile.Write respectively instead.

Important

This API is not CLS-compliant.

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.

C#
[System.CLSCompliant(false)]
[System.Obsolete("Thread.VolatileRead and Thread.VolatileWrite are obsolete. Use Volatile.Read or Volatile.Write respectively instead.", DiagnosticId="SYSLIB0054", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public static uint VolatileRead(ref uint address);
C#
[System.CLSCompliant(false)]
public static uint VolatileRead(ref uint address);

Parameters

address
UInt32

The field to be read.

Returns

The value that was read.

Attributes

Remarks

Thread.VolatileRead and Thread.VolatileWrite are legacy APIs and have been replaced by Volatile.Read and Volatile.Write. See the Volatile class for more information.

Applies to

.NET 10 and other versions
Product Versions (Obsolete)
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8 (9, 10)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1

VolatileRead(Object)

Source:
Thread.cs
Source:
Thread.cs
Source:
Thread.cs

Caution

Thread.VolatileRead and Thread.VolatileWrite are obsolete. Use Volatile.Read or Volatile.Write respectively instead.

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.

C#
[System.Obsolete("Thread.VolatileRead and Thread.VolatileWrite are obsolete. Use Volatile.Read or Volatile.Write respectively instead.", DiagnosticId="SYSLIB0054", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public static object? VolatileRead(ref object? address);
C#
public static object? VolatileRead(ref object? address);
C#
public static object VolatileRead(ref object address);

Parameters

address
Object

The field to be read.

Returns

The value that was read.

Attributes

Remarks

Thread.VolatileRead and Thread.VolatileWrite are legacy APIs and have been replaced by Volatile.Read and Volatile.Write. See the Volatile class for more information.

Applies to

.NET 10 and other versions
Product Versions (Obsolete)
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8 (9, 10)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1

VolatileRead(UIntPtr)

Source:
Thread.cs
Source:
Thread.cs
Source:
Thread.cs

Caution

Thread.VolatileRead and Thread.VolatileWrite are obsolete. Use Volatile.Read or Volatile.Write respectively instead.

Important

This API is not CLS-compliant.

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.

C#
[System.CLSCompliant(false)]
[System.Obsolete("Thread.VolatileRead and Thread.VolatileWrite are obsolete. Use Volatile.Read or Volatile.Write respectively instead.", DiagnosticId="SYSLIB0054", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public static UIntPtr VolatileRead(ref UIntPtr address);
C#
[System.CLSCompliant(false)]
public static UIntPtr VolatileRead(ref UIntPtr address);

Parameters

address
UIntPtr

The field to be read.

Returns

UIntPtr

The value that was read.

Attributes

Remarks

Thread.VolatileRead and Thread.VolatileWrite are legacy APIs and have been replaced by Volatile.Read and Volatile.Write. See the Volatile class for more information.

Applies to

.NET 10 and other versions
Product Versions (Obsolete)
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8 (9, 10)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1

VolatileRead(UInt16)

Source:
Thread.cs
Source:
Thread.cs
Source:
Thread.cs

Caution

Thread.VolatileRead and Thread.VolatileWrite are obsolete. Use Volatile.Read or Volatile.Write respectively instead.

Important

This API is not CLS-compliant.

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.

C#
[System.CLSCompliant(false)]
[System.Obsolete("Thread.VolatileRead and Thread.VolatileWrite are obsolete. Use Volatile.Read or Volatile.Write respectively instead.", DiagnosticId="SYSLIB0054", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public static ushort VolatileRead(ref ushort address);
C#
[System.CLSCompliant(false)]
public static ushort VolatileRead(ref ushort address);

Parameters

address
UInt16

The field to be read.

Returns

The value that was read.

Attributes

Remarks

Thread.VolatileRead and Thread.VolatileWrite are legacy APIs and have been replaced by Volatile.Read and Volatile.Write. See the Volatile class for more information.

Applies to

.NET 10 and other versions
Product Versions (Obsolete)
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8 (9, 10)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1

VolatileRead(Int64)

Source:
Thread.cs
Source:
Thread.cs
Source:
Thread.cs

Caution

Thread.VolatileRead and Thread.VolatileWrite are obsolete. Use Volatile.Read or Volatile.Write respectively instead.

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.

C#
[System.Obsolete("Thread.VolatileRead and Thread.VolatileWrite are obsolete. Use Volatile.Read or Volatile.Write respectively instead.", DiagnosticId="SYSLIB0054", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public static long VolatileRead(ref long address);
C#
public static long VolatileRead(ref long address);

Parameters

address
Int64

The field to be read.

Returns

The value that was read.

Attributes

Remarks

Thread.VolatileRead and Thread.VolatileWrite are legacy APIs and have been replaced by Volatile.Read and Volatile.Write. See the Volatile class for more information.

Applies to

.NET 10 and other versions
Product Versions (Obsolete)
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8 (9, 10)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1

VolatileRead(IntPtr)

Source:
Thread.cs
Source:
Thread.cs
Source:
Thread.cs

Caution

Thread.VolatileRead and Thread.VolatileWrite are obsolete. Use Volatile.Read or Volatile.Write respectively instead.

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.

C#
[System.Obsolete("Thread.VolatileRead and Thread.VolatileWrite are obsolete. Use Volatile.Read or Volatile.Write respectively instead.", DiagnosticId="SYSLIB0054", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public static IntPtr VolatileRead(ref IntPtr address);
C#
public static IntPtr VolatileRead(ref IntPtr address);

Parameters

address
IntPtr

The field to be read.

Returns

IntPtr

The value that was read.

Attributes

Remarks

Thread.VolatileRead and Thread.VolatileWrite are legacy APIs and have been replaced by Volatile.Read and Volatile.Write. See the Volatile class for more information.

Applies to

.NET 10 and other versions
Product Versions (Obsolete)
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8 (9, 10)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1

VolatileRead(Int16)

Source:
Thread.cs
Source:
Thread.cs
Source:
Thread.cs

Caution

Thread.VolatileRead and Thread.VolatileWrite are obsolete. Use Volatile.Read or Volatile.Write respectively instead.

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.

C#
[System.Obsolete("Thread.VolatileRead and Thread.VolatileWrite are obsolete. Use Volatile.Read or Volatile.Write respectively instead.", DiagnosticId="SYSLIB0054", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public static short VolatileRead(ref short address);
C#
public static short VolatileRead(ref short address);

Parameters

address
Int16

The field to be read.

Returns

The value that was read.

Attributes

Remarks

Thread.VolatileRead and Thread.VolatileWrite are legacy APIs and have been replaced by Volatile.Read and Volatile.Write. See the Volatile class for more information.

Applies to

.NET 10 and other versions
Product Versions (Obsolete)
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8 (9, 10)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1

VolatileRead(Double)

Source:
Thread.cs
Source:
Thread.cs
Source:
Thread.cs

Caution

Thread.VolatileRead and Thread.VolatileWrite are obsolete. Use Volatile.Read or Volatile.Write respectively instead.

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.

C#
[System.Obsolete("Thread.VolatileRead and Thread.VolatileWrite are obsolete. Use Volatile.Read or Volatile.Write respectively instead.", DiagnosticId="SYSLIB0054", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public static double VolatileRead(ref double address);
C#
public static double VolatileRead(ref double address);

Parameters

address
Double

The field to be read.

Returns

The value that was read.

Attributes

Remarks

Thread.VolatileRead and Thread.VolatileWrite are legacy APIs and have been replaced by Volatile.Read and Volatile.Write. See the Volatile class for more information.

Applies to

.NET 10 and other versions
Product Versions (Obsolete)
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8 (9, 10)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1

VolatileRead(Byte)

Source:
Thread.cs
Source:
Thread.cs
Source:
Thread.cs

Caution

Thread.VolatileRead and Thread.VolatileWrite are obsolete. Use Volatile.Read or Volatile.Write respectively instead.

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.

C#
[System.Obsolete("Thread.VolatileRead and Thread.VolatileWrite are obsolete. Use Volatile.Read or Volatile.Write respectively instead.", DiagnosticId="SYSLIB0054", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public static byte VolatileRead(ref byte address);
C#
public static byte VolatileRead(ref byte address);

Parameters

address
Byte

The field to be read.

Returns

The value that was read.

Attributes

Remarks

Thread.VolatileRead and Thread.VolatileWrite are legacy APIs and have been replaced by Volatile.Read and Volatile.Write. See the Volatile class for more information.

Applies to

.NET 10 and other versions
Product Versions (Obsolete)
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8 (9, 10)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1

VolatileRead(Int32)

Source:
Thread.cs
Source:
Thread.cs
Source:
Thread.cs

Caution

Thread.VolatileRead and Thread.VolatileWrite are obsolete. Use Volatile.Read or Volatile.Write respectively instead.

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.

C#
[System.Obsolete("Thread.VolatileRead and Thread.VolatileWrite are obsolete. Use Volatile.Read or Volatile.Write respectively instead.", DiagnosticId="SYSLIB0054", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public static int VolatileRead(ref int address);
C#
public static int VolatileRead(ref int address);

Parameters

address
Int32

The field to be read.

Returns

The value that was read.

Attributes

Remarks

Thread.VolatileRead and Thread.VolatileWrite are legacy APIs and have been replaced by Volatile.Read and Volatile.Write. See the Volatile class for more information.

Applies to

.NET 10 and other versions
Product Versions (Obsolete)
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8 (9, 10)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1