/
aprogrammer
/
dotnet-docs
Обзор
Документация
Войти
/
aprogrammer
/
dotnet-docs
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
samples/snippets/visualbasic/VS_Snippets_CLR/conceptual.basicio.textfiles/vb/async.vb
20 строк
683 B
Andy De George
Move snippets from samples repo to this repo (#17296)
03 мар 2020, 19:23
Не верифицирован
03 мар 2020, 19:23
dbbeda1
Код
Авторство
О чём код?
Imports System.IO Public Module Example Public Sub Main() WriteTextAsync() End Sub Async Sub WriteTextAsync() ' Set a variable to the Documents path. Dim docPath As String = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) ' Write the text asynchronously to a new file named "WriteTextAsync.txt". Using outputFile As New StreamWriter(Path.Combine(docPath, Convert.ToString("WriteTextAsync.txt"))) Await outputFile.WriteAsync("This is a sentence.") End Using End Sub End Module ' The example creates a file named "WriteTextAsync.txt" with the following contents: ' This is a sentence.