最近几种C#使用总结

来源:互联网 发布:winrar软件下载免费版 编辑:程序博客网 时间:2024/06/05 10:17


//c#中计算时间方法:
// example2: Stopwatch class
System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
sw.Start();
System.Threading.Thread.Sleep(time_cap);
sw.Stop();

TimeSpan ts2 = sw.Elapsed;
Console.WriteLine("example2 time {0}", ts2.TotalMilliseconds);


//读取date.csv中的数据至List<string> STRS.

List<string> STRS = new List<string>();
            StreamReader sr = new StreamReader("date.csv", Encoding.Default);
            String line;
            while ((line = sr.ReadLine()) != null)
            {
                //Console.WriteLine(line.ToString());
                STRS.Add(line.ToString());
            }
            return STRS;

0 0
原创粉丝点击