|
Please look at the following code: When you execute this program, I did not call the work () method. What is going on? What should be done if it is resolved? Thank you!
class Class1
{
[STAThread]
static void Main (string [] args)
{
Thread currentThread = Thread.CurrentThread;
Thread workThread = new Thread (new ThreadStart (Work));
Ranch
}
static void Work ()
{
bool ishasTxt;
if (File.Exists ("D:\\files.txt"))
{
ishasTxt = true;
}
else
{
ishasTxt = false;
}
StreamWriter sr = new StreamWriter ("D:\\filesOne.txt", ishasTxt);
sr.WriteLine ("this is my file");
sr.WriteLine ("I can write ints {0} or floats {1}, and so on.", 1, 4.2);
sr.Close ();
}
} |
|