'Visual Basic 2010 Debugging in Visual Studio Instrumenting Applications Class Example1 Public Shared Sub Main() Dim thread1 As New System.Threading.Thread(AddressOf Test) thread1.Name = "thread1" ' Dim thread2 As New System.Threading.Thread(AddressOf Test) thread2.Name = "thread2" ' thread1.Start(1) thread2.Start(2) ' Console.ReadLine() End Sub Public Shared Sub Test(ByVal ID As Integer) Console.WriteLine("Test " & ID) ' (1) End Sub End Class Class Example2 Public Shared Sub Main() Console.WriteLine(Method1(10)) End Sub Public Shared Function Method1(ByVal value As Integer) As Integer Return value * 2 End Function End Class Class Example3 Public Shared Sub Main() Dim arguments As String() = Environment.GetCommandLineArgs() ' Dim value1 As Integer = arguments(1) Dim value2 As Integer = arguments(2) Dim operation As String = arguments(3) ' Select Case operation Case "/operation:sum" Console.WriteLine(value1 & " + " & value2 & " = " & _ value1 + value2) Case "/operation:multiply" Console.WriteLine(value1 & " * " & value2 & " = " & _ value1 * value2) Case Else Console.WriteLine("Unknown operation.") End Select ' Console.ReadLine() End Sub End Class Class Counter Private m_Value As Integer Public Sub New(ByVal value As Integer) m_Value = value ' (1) End Sub Public ReadOnly Property Value() As Integer Get Value = m_Value End Get End Property Public Sub Raise() m_Value += 1 End Sub End Class Class Example4 Public Shared Sub Main() Dim counter1 As New Counter(5) Dim arrayList1 As New ArrayList arrayList1.Add(counter1) ' Console.ReadLine() ' (2) End Sub End Class 'Bezoek www.vbvoorbeelden.be voor meer Visual Basic voorbeelden. 'Copyright - De Wolf / vbvoorbeelden - 2003-2011 - Alle rechten voorbehouden.