【发布时间】:2014-08-13 13:00:45
【问题描述】:
我想在这里做一些改变,我想把这个应用程序转换成winforms。我想将这些输出存储到一个文本文件中,我该怎么做?请帮忙
using System;
using System.Threading;
public static class Program
{
public static void Main()
{
// Create a Timer object that knows to call our TimerCallback
// method once every 2000 milliseconds.
Timer t = new Timer(TimerCallback, null, 0, 1000);
// Wait for the user to hit <Enter>
Console.ReadLine();
}
private static void TimerCallback(Object o)
{
// Display the date/time when this method got called.
Console.WriteLine(DateTime.Now);
// Force a garbage collection to occur for this demo.
GC.Collect();
}
}
此应用程序的输出。
【问题讨论】:
-
它不工作,我想改变它的语法...
-
顺便问一下,您为什么只是从这里获取代码? stackoverflow.com/questions/186084/…
-
从控制台软件中的大量内容来看,最好和最简单的方法是创建一个新项目并将相关代码从旧控制台项目复制到新的闪亮的 winform 中。