Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>net9.0</TargetFramework>
</PropertyGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Public class Simple
+ "starting the new InstanceCaller thread.")

' Create the thread object, passing in the
' serverObject.SharedMethod method using a
' ServerClass.SharedMethod method using a
' ThreadStart delegate.
Dim SharedCaller As New Thread( _
New ThreadStart(AddressOf ServerClass.SharedMethod))
Expand All @@ -56,9 +56,9 @@ Public class Simple
End Class
' The example displays output like the following:
' The Main() thread calls this after starting the new InstanceCaller thread.
' The Main() thread calls this after starting the new StaticCaller thread.
' ServerClass.StaticMethod is running on another thread.
' The Main() thread calls this after starting the new SharedCaller thread.
' ServerClass.SharedMethod is running on another thread.
' ServerClass.InstanceMethod is running on another thread.
' The instance method called by the worker thread has ended.
' The static method called by the worker thread has ended.
' The shared method called by the worker thread has ended.
'</snippet2>
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
'<snippet4>
Imports System.Threading

' The ThreadWithState class contains the information needed for
' The ThreadWithState2 class contains the information needed for
' a task, the method that executes the task, and a delegate
' to call when the task is complete.
Public Class ThreadWithState
Public Class ThreadWithState2
' State information used in the task.
Private boilerplate As String
Private numberValue As Integer
Expand Down Expand Up @@ -34,13 +34,12 @@ Public Class ThreadWithState
End Class

' Delegate that defines the signature for the callback method.
'
Public Delegate Sub ExampleCallback(lineCount As Integer)

Public Class Example
Public Class Example2
Public Shared Sub Main()
' Supply the state information required by the task.
Dim tws As New ThreadWithState( _
Dim tws As New ThreadWithState2( _
"This report displays the number {0}.", _
42, _
AddressOf ResultCallback)
Expand Down