使用 StreamWriter 將行單獨寫入文字檔案

Using sw As New System.IO.StreamWriter("path\to\file.txt")
    sw.WriteLine("Hello world")
End Using

當使用 Implements IDisposable 的物件時,建議使用 Using 塊