/
aprogrammer
/
dotnet-docs
Обзор
Документация
Войти
/
aprogrammer
/
dotnet-docs
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
samples/snippets/visualbasic/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter/VB/source6.vb
34 строки
1 KB
Andy De George
Move snippets from samples repo to this repo (#17296)
03 мар 2020, 19:23
Не верифицирован
03 мар 2020, 19:23
dbbeda1
Код
Авторство
О чём код?
'<snippet7> Imports System.IO Class MyStream Private Const FILE_NAME As String = "Test.data" Public Shared Sub Main() If File.Exists(FILE_NAME) Then Console.WriteLine($"{FILE_NAME} already exists!") Return End If Using fs As New FileStream(FILE_NAME, FileMode.CreateNew) Using w As New BinaryWriter(fs) For i As Integer = 0 To 10 w.Write(i) Next End Using End Using Using fs As New FileStream(FILE_NAME, FileMode.Open, FileAccess.Read) Using r As New BinaryReader(fs) For i As Integer = 0 To 10 Console.WriteLine(r.ReadInt32()) Next End Using End Using End Sub End Class ' The example creates a file named "Test.data" and writes the integers 0 through 10 to it in binary format. ' It then writes the contents of Test.data to the console with each integer on a separate line. '</snippet7>