using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Timers;
using System.IO;
namespace TimerApp4
{
class Program
{
public static int k;
static void Main(string[] args)
{
Timer t = new Timer(1000);
t.Elapsed += new ElapsedEventHandler(SaniyelikIs);
t.Start();
k = 0;
Console.Read();
}
static void SaniyelikIs(object o, ElapsedEventArgs a)
{
TextWriter tw = null;
k++;
if (k == 0)
{
tw = new StreamWriter("TextFile1.txt");
// write a line of text to the file
tw.WriteLine(DateTime.Now);
}
else
tw.WriteLine(DateTime.Now);
// close the stream
tw.Close();
}
}
}
i can run it but "new StreamWriter("TextFile1.txt"); " gives me error: Unassigned local variable. That is results. How can i ru it