Mercurial > silverbladetech
comparison MetroWpf/MetroWpf.Framework/TimedDelegates.cs @ 15:060f02cd4591
Initial commit, pre airport work
author | stevenh7776 stevenhollidge@hotmail.com |
---|---|
date | Mon, 12 Mar 2012 23:05:21 +0800 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
14:741981715d94 | 15:060f02cd4591 |
---|---|
1 using System; | |
2 using System.Diagnostics; | |
3 | |
4 namespace MetroWpf.Framework | |
5 { | |
6 public class TimedDelegates | |
7 { | |
8 public static void ExecuteAction( | |
9 Action action, | |
10 out Stopwatch stopwatch) | |
11 { | |
12 stopwatch = new Stopwatch(); | |
13 stopwatch.Start(); | |
14 action(); | |
15 stopwatch.Stop(); | |
16 } | |
17 | |
18 public static void ExecuteAction<T>( | |
19 Action<T> action, | |
20 T paramIn, | |
21 out Stopwatch stopwatch) | |
22 { | |
23 stopwatch = new Stopwatch(); | |
24 stopwatch.Start(); | |
25 action(paramIn); | |
26 stopwatch.Stop(); | |
27 } | |
28 | |
29 public static T ExecuteFunc<T>( | |
30 Func<T> func, | |
31 out Stopwatch stopwatch) | |
32 { | |
33 stopwatch = new Stopwatch(); | |
34 stopwatch.Start(); | |
35 T result = func(); | |
36 stopwatch.Stop(); | |
37 return result; | |
38 } | |
39 | |
40 public static T ExecuteFunc<T>( | |
41 Func<T, T> func, | |
42 T paramIn, | |
43 out Stopwatch stopwatch) | |
44 { | |
45 stopwatch = new Stopwatch(); | |
46 stopwatch.Start(); | |
47 T result = func(paramIn); | |
48 stopwatch.Stop(); | |
49 return result; | |
50 } | |
51 } | |
52 } |