DennyDotNet

Awesome ASP.NET C# and other cool coding stuff

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

Categories

None


Disclaimer

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

© Copyright 2010

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: 


ExecuteWithTimeout<T>(this Func<T> delegateToRun, TimeSpan timeout)

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

Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList

Posted by Denny on Wednesday, February 13, 2008 8:44 AM
Permalink | Comments (0) | Post RSSRSS comment feed

Comments

Comments are closed