/// <summary> /// Whiches the equals is faster. /// No, not really... just determines which of the two implementations of Equals is faster. /// </summary> public static SafeDictionary <string, TimeSpan> WhichEqualsIsFaster() { var dict = new SafeDictionary <string, Action>(); var t1 = new TypeCheckAndCast(1); var t2 = new TypeCheckAndCast(2); var a1 = new AsOperator(1); var a2 = new AsOperator(1); dict["Type-check and cast"] = () => { t1.Equals(t1); t1.Equals(t2); t1.Equals(a1); }; dict["As operator and null-check"] = () => { a1.Equals(a1); a1.Equals(a2); a1.Equals(t1); }; return(GottaGoFast.Run(dict)); }
private static void PrintReport(IDictionary <string, TimeSpan> data) { Console.WriteLine(GottaGoFast.CreateReport(data)); }