Skip to content

Instantly share code, notes, and snippets.

@mthomas
Created November 8, 2010 01:00
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 mthomas/667249 to your computer and use it in GitHub Desktop.
Save mthomas/667249 to your computer and use it in GitHub Desktop.
public static class DemoExtensions{
public static T Pick<T>(this IEnumerable<T> items){
/*return random element out of items*/
}
public static T Take<T>(this IList<T> items){
/*thread safe: return random element out of items and remove it*/
}
public static IList<T> Times<T>(this int x, Func<int, T> action){
/*use Parallel.For to execute action x times, aggregate results into a list and return it*/
/*wrap each execution in a new NHibernate session scope*/
}
public static IList<TResult> Each<T, TResult>(this IEnumerable<T> items, Func<T, TResult> action){
/*use Parallel.each to transform each item in items, aggregate results, return */
/*wrap each execution in a new NHibernate session scope*/
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment