Mercurial > silverbladetech
annotate Stocks/Stocks.Common/Core/TimedDelegates.cs @ 4:57f20ba55884
Fix for webClientShim to use downloadString instead of downloadData
Refactoring and introduction of static TimedDelegates.Execute() helper method
author | stevenh7776 stevenhollidge@hotmail.com |
---|---|
date | Mon, 20 Feb 2012 23:04:58 +0700 |
parents | |
children |
rev | line source |
---|---|
4
57f20ba55884
Fix for webClientShim to use downloadString instead of downloadData
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
1 using System; |
57f20ba55884
Fix for webClientShim to use downloadString instead of downloadData
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
2 using System.Diagnostics; |
57f20ba55884
Fix for webClientShim to use downloadString instead of downloadData
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
3 |
57f20ba55884
Fix for webClientShim to use downloadString instead of downloadData
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
4 namespace Stocks.Common.Core |
57f20ba55884
Fix for webClientShim to use downloadString instead of downloadData
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
5 { |
57f20ba55884
Fix for webClientShim to use downloadString instead of downloadData
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
6 public class TimedDelegates |
57f20ba55884
Fix for webClientShim to use downloadString instead of downloadData
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
7 { |
57f20ba55884
Fix for webClientShim to use downloadString instead of downloadData
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
8 public static T Execute<T>( |
57f20ba55884
Fix for webClientShim to use downloadString instead of downloadData
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
9 Func<T, T> func, |
57f20ba55884
Fix for webClientShim to use downloadString instead of downloadData
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
10 T paramIn, |
57f20ba55884
Fix for webClientShim to use downloadString instead of downloadData
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
11 out Stopwatch stopwatch) |
57f20ba55884
Fix for webClientShim to use downloadString instead of downloadData
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
12 { |
57f20ba55884
Fix for webClientShim to use downloadString instead of downloadData
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
13 stopwatch = new Stopwatch(); |
57f20ba55884
Fix for webClientShim to use downloadString instead of downloadData
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
14 stopwatch.Start(); |
57f20ba55884
Fix for webClientShim to use downloadString instead of downloadData
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
15 T result = func(paramIn); |
57f20ba55884
Fix for webClientShim to use downloadString instead of downloadData
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
16 stopwatch.Stop(); |
57f20ba55884
Fix for webClientShim to use downloadString instead of downloadData
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
17 return result; |
57f20ba55884
Fix for webClientShim to use downloadString instead of downloadData
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
18 } |
57f20ba55884
Fix for webClientShim to use downloadString instead of downloadData
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
19 } |
57f20ba55884
Fix for webClientShim to use downloadString instead of downloadData
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
20 } |