Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
21
Task/Time-a-function/C-sharp/time-a-function-2.cs
Normal file
21
Task/Time-a-function/C-sharp/time-a-function-2.cs
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
|
||||
class Program {
|
||||
static void Main(string[] args) {
|
||||
DateTime start, end;
|
||||
|
||||
start = DateTime.Now;
|
||||
DoSomething();
|
||||
end = DateTime.Now;
|
||||
|
||||
Console.WriteLine("DoSomething() took " + (end - start).TotalMilliseconds + "ms");
|
||||
}
|
||||
|
||||
static void DoSomething() {
|
||||
Thread.Sleep(1000);
|
||||
|
||||
Enumerable.Range(1, 10000).Where(x => x % 2 == 0).Sum(); // Sum even numers from 1 to 10000
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue