¡@

Home 

c# Programming Glossary: stopwatch.startnew

Performance surprise with “as” and nullable types

http://stackoverflow.com/questions/1583050/performance-surprise-with-as-and-nullable-types

static void FindSumWithCast object values Stopwatch sw Stopwatch.StartNew int sum 0 foreach object o in values if o is int int x int.. static void FindSumWithAs object values Stopwatch sw Stopwatch.StartNew int sum 0 foreach object o in values int x o as int if x.HasValue.. static void FindSumWithLinq object values Stopwatch sw Stopwatch.StartNew int sum values.OfType int .Sum sw.Stop Console.WriteLine LINQ..

Is DateTime.Now the best way to measure a function's performance?

http://stackoverflow.com/questions/28637/is-datetime-now-the-best-way-to-measure-a-functions-performance

not. Use the Stopwatch in System.Diagnostics Stopwatch sw Stopwatch.StartNew PerformWork sw.Stop Console.WriteLine Time taken 0 ms sw.Elapsed.TotalMilliseconds..

Performance Tests of Serializations used by WCF Bindings

http://stackoverflow.com/questions/3790728/performance-tests-of-serializations-used-by-wcf-bindings

ms.Length ms.Position 0 ser.Deserialize ms var watch Stopwatch.StartNew for int i 0 i LOOP i ms.Position 0 ms.SetLength 0 ser.Serialize.. Serialize watch.ElapsedMilliseconds watch Stopwatch.StartNew for int i 0 i LOOP i ms.Position 0 ser.Deserialize ms watch.Stop.. ms.Length ms.Position 0 ser.Deserialize ms var watch Stopwatch.StartNew for int i 0 i LOOP i ms.Position 0 ms.SetLength 0 ser.Serialize..

Casting vs using the 'as' keyword in the CLR

http://stackoverflow.com/questions/496096/casting-vs-using-the-as-keyword-in-the-clr

void FindLengthWithIsAndCast object values Stopwatch sw Stopwatch.StartNew int len 0 foreach object o in values if o is string string.. void FindLengthWithIsAndAs object values Stopwatch sw Stopwatch.StartNew int len 0 foreach object o in values if o is string string.. FindLengthWithAsAndNullCheck object values Stopwatch sw Stopwatch.StartNew int len 0 foreach object o in values string a o as string if..

Convert generic List/Enumerable to DataTable?

http://stackoverflow.com/questions/564366/convert-generic-list-enumerable-to-datatable

GC.WaitForFullGCComplete Stopwatch watch Stopwatch.StartNew for int i 0 i 500 i data.ToDataTable watch.Stop Console.WriteLine..