I'm doing a tutorial on how to save a text file with StreamWriter. I understand how to do it but I started reading a tutorial on the StreamWriter Class to get a better understanding of it. In an example, it places the word using StreamWriter but in the other tutorial, it does not. Why is this? Do I need to use the using?
how to save to text tutorials way
private void button3_Click(object sender, EventArgs e)
{
StreamWriter File = new StreamWriter("data.txt", true);
File.Write("");
File.Close();
}
== StreamWriter Class In C# With Programming Example ==
namespace StreamWriter_Class
{
class Program
{
static void Main(string[] args)
{
string file = @"D:\csharpfile.txt";
---> using (StreamWriter writer = new StreamWriter(file))