Brian:

I ran this through the C# to Vb web tool and below is what I got (After I took out the 
comments).  

Questions:
1)  What is _value?
2)  How is it different from the bottom class?  What functionality does it give me 
that the bottom class doesn't?
3)  What is volatile?


NotInheritable Public Class Singleton
   Private Shared Singleton As volatile
   Private __unknown As _value 
   Private Shared syncRoot = New [Object]()
   
   Public Shared ReadOnly Property Value() As Singleton
      Get
         If _value Is Nothing Then
            SyncLock syncRoot
               If _value Is Nothing Then
                  _value = New Singleton()
               End If  
            End SyncLock  
         End If  
         Return _value
      End Get  
   End Property 
End Class 


NotInheritable Public Class Singleton
   Private Shared mValue as Singleton  
   
   Public Shared ReadOnly Property Value() As Singleton
      Get
         If mValue Is Nothing Then
            mValue = New Singleton()  
         End If  
         Return mValue
      End Get  
   End Property 
End Class 

You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced 
DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to