I've got some classes for a program and the classes were written in
Module1. It works fine however I am curious if instead of doing
"project|add module" I'd done "project|add class" how is that different?
Here is the module I added. Note it contains 2 classes and the sub main.
Module Module1
<STAThread()> Public Sub main(ByVal CmdArgs() As String)
Dim mainForm As New Form1
Application.Run(mainForm)
End Sub
Public Class MyThreadCount
Private Shared m_lock As New Object
Private Shared m_threadcount As Int32 = 0
Public Shared Sub Increment()
SyncLock (m_lock)
m_threadcount += 1
End SyncLock
End Sub
Public Shared Sub Decrement()
SyncLock (m_lock)
m_threadcount -= 1
End SyncLock
End Sub
Public Shared ReadOnly Property ThreadCount() As Int32
Get
Dim _count As Int32
SyncLock (m_lock)
_count = m_threadcount
End SyncLock
Return _count
End Get
End Property
End Class
Public Class MyStringLogger
Private Shared m_loglock As New Object
Public Shared Sub Write(ByVal str As String)
SyncLock (m_loglock)
Dim sw As New System.io.StreamWriter("c:\validate.log",
True)
sw.WriteLine(str)
sw.Close()
End SyncLock
End Sub
End Class
End Module