Denny.NET

I can haz ASP.NET goodness?

About the author

Denny Ferrassoli
Developer at Casting Networks. MCP / .NET
E-mail me Send mail
Add to Technorati Favorites

Recent posts

Recent comments

Authors

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2008

Execute a Delegate with a Timeout

Was browsing through Gustavo Duarte's "Lock Down SQL Server 2005" blog and came across a link for "Generic C# code for executing a delegate with a timeout."

It's a very useful snippet of code and reuseable.

Here's the method signature: 

[code:c#]
ExecuteWithTimeout<T>(this Func<T> delegateToRun, TimeSpan timeout)
[/code]

If the execution takes longer than timeout a TimeoutException will occur.

Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Categories: ASP.NET | Server-Side
Posted by Denny on Wednesday, February 13, 2008 1:44 PM
Permalink | Comments (0) | Post RSSRSS comment feed

Related posts

Add comment


(Will show your Gravatar icon)  

  Country flag

[b][/b] - [i][/i] - [u][/u]- [quote][/quote]



Live preview

Sunday, July 06, 2008 4:44 PM