Skip to content

Instantly share code, notes, and snippets.

@renestein
Created September 3, 2010 06:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save renestein/563485 to your computer and use it in GitHub Desktop.
Save renestein/563485 to your computer and use it in GitHub Desktop.
public static TResult GetFirstResult<TSource, TResult>(
IEnumerable<TSource> source, Func<TSource, TResult> invokeAction)
{
if (source== null)
{
throw new ArgumentNullException("source");
}
if (invokeAction== null)
{
throw new ArgumentNullException("invokeAction");
}
return source.AsParallel().Select(item => invokeAction(item)).First();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment