Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 21st, 2012  |  syntax: None  |  size: 0.42 KB  |  hits: 13  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. How do I use Thread.VolatileWrite with reference types with Option Strict On?
  2. Option Strict On
  3. Imports System.Threading
  4. Module Module1
  5.     Dim str As String
  6.     Sub Main()
  7.         Thread.VolatileWrite(str, "HELLO") ' Compiler error.
  8.         Thread.VolatileWrite(CObj(str), "HELLO") ' Fails silently.
  9.         Thread.VolatileWrite(DirectCast(str), "HELLO") ' Fails silently.
  10.         Console.WriteLine(str)
  11.     End Sub
  12. End Module