static void UseStopwatch(MyWatch quiz2, string command) { switch (command) { case "start": try { quiz2.Start(); } catch (InvalidOperationException) { Console.WriteLine("stopWatch is already started\n"); } break; case "stop": try { quiz2.Stop(); Console.WriteLine("Duration: {0}\n", quiz2.GetDuration()); } catch (InvalidOperationException) { Console.WriteLine("stopWatch is not started\n"); } break; default: break; } }
public void DataTable1() { DataTable dt = null; for (int i = 0; i < 1; i++) { string sql = " select top 1111 * from companyinfo "; dt = nda.ExecuteDataTable(sql); foreach (DataRow dr in dt.Rows) { // Console.WriteLine(dr[4]); } } MyWatch sp = new MyWatch(); sp.Start(); // List<Company> list = nda.GetEntityList<Company>(dt); sp.End(); }
public void Write2File(long iterations = 10, int progLength = 20) { MyWatch t = new MyWatch(); GenerateCSV generateCSV = new GenerateCSV(); t.Start(); using (StreamWriter sw = new StreamWriter(myFn)) { string line; MyProgBar progressBar = new MyProgBar(iterations, progLength); progressBar.Init(); for (int i = 1; i <= iterations; i++) { progressBar.Step(i); line = generateCSV.GenerateLine(); sw.WriteLine(line); } } t.StopAndPrint(); }