|
请看下面代码: 请问大家我在执行的时候这段程序并没有调用work()这个方法,请问这是怎么回事?如果解决应当怎么解决? 谢谢!
class Class1
{
[STAThread]
static void Main(string[] args)
{
Thread currentThread = Thread.CurrentThread;
Thread workThread = new Thread(new ThreadStart(Work));
}
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();
}
} |
|