While learning about creating singleton objects and the problems when using them with threads in VB.NET i found the following post How do I specify the equivalent of volatile in VB.net?
The marked answer shows the following methods
Function VolatileRead(Of T)(ByRef Address As T) As T
VolatileRead = Address
Threading.Thread.MemoryBarrier()
End Function
Sub VolatileWrite(Of T)(ByRef Address As T, ByVal Value As T)
Threading.Thread.MemoryBarrier()
Address = Value
End Sub
But how do i use this methods in my application to create a singleton object?