public static void ShowTakenTime(MyCollections firstCollection, MyCollections secondCollection, TimeSpan ts1, TimeSpan ts2) { Console.WriteLine("{0}: {1} ms", firstCollection.GetCollectionName(), ts1.TotalMilliseconds); Console.WriteLine("{0}: {1} ms", secondCollection.GetCollectionName(), ts2.TotalMilliseconds); }
public static void CompareObjects(MyCollections firstCollection, MyCollections secondCollection) { TimeSpan ts1 = new TimeSpan(); TimeSpan ts2 = new TimeSpan(); Console.WriteLine("========================================================================"); Console.WriteLine("{0} VS {1}", firstCollection.GetCollectionName(), secondCollection.GetCollectionName()); Console.WriteLine(""); ts1 = firstCollection.Init(PackGift()); ts2 = secondCollection.Init(PackGift()); ShowTimeSpan("Add", firstCollection, secondCollection, ts1, ts2); ts1 = firstCollection.GetNElement(500); ts2 = secondCollection.GetNElement(500); ShowTimeSpan("Search", firstCollection, secondCollection, ts1, ts2); ts1 = firstCollection.RemoveNElement(500); ts2 = secondCollection.RemoveNElement(500); ShowTimeSpan("Delete", firstCollection, secondCollection, ts1, ts2); Console.WriteLine("========================================================================"); Console.WriteLine(""); }
public static void ShowTimeSpan(string operation, MyCollections firstCollection, MyCollections secondCollection, TimeSpan ts1, TimeSpan ts2) { Console.WriteLine(""); switch (operation) { case "Add": { Console.WriteLine("--- Operation ADD ---"); break; } case "Search": { Console.WriteLine("--- Operation SEARCH ---"); break; } case "Delete": { Console.WriteLine("--- Operation DELETE ---"); break; } } ShowTakenTime(firstCollection, secondCollection, ts1, ts2); Compare(firstCollection.GetCollectionName(), ts1, secondCollection.GetCollectionName(), ts2); }