/
aprogrammer
/
dotnet-docs
Обзор
Документация
Войти
/
aprogrammer
/
dotnet-docs
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
samples/snippets/visualbasic/VS_Snippets_CLR/AsyncDelegateExamples/VB/TestMethod.vb
22 строки
877 B
Next Turn
Format codes based on .editorconfig, Part 5 (#18868)
10 июн 2020, 17:09
Не верифицирован
10 июн 2020, 17:09
31be9cf
Код
Авторство
О чём код?
' <Snippet1> Imports System.Threading Imports System.Runtime.InteropServices Namespace Examples.AdvancedProgramming.AsynchronousOperations Public Class AsyncDemo ' The method to be executed asynchronously. Public Function TestMethod(ByVal callDuration As Integer, _ <Out> ByRef threadId As Integer) As String Console.WriteLine("Test method begins.") Thread.Sleep(callDuration) threadId = Thread.CurrentThread.ManagedThreadId() return String.Format("My call time was {0}.", callDuration.ToString()) End Function End Class ' The delegate must have the same signature as the method ' it will call asynchronously. Public Delegate Function AsyncMethodCaller(ByVal callDuration As Integer, _ <Out> ByRef threadId As Integer) As String End Namespace '</Snippet1>