/
aprogrammer
/
dotnet-docs
Обзор
Документация
Войти
/
aprogrammer
/
dotnet-docs
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
docs/csharp/language-reference/keywords/snippets/UsingKeywordExample.cs
21 строка
529 B
Olabamiji Oyetubo
Bigboybamo using examples (#41020)
21 май 2024, 18:05
Не верифицирован
21 май 2024, 18:05
0e9c23d
Код
Авторство
О чём код?
// <UsingDirective> using System; using System.IO; // </UsingDirective> public class UsingStatementSample { public static void Main() { // <UsingStatement> string filePath = "example.txt"; string textToWrite = "Hello, this is a test message!"; // Use the using statement to ensure the StreamWriter is properly disposed of using (StreamWriter writer = new StreamWriter(filePath)) { writer.WriteLine(textToWrite); } // </UsingStatement> } }