Tuesday, July 13, 2010

Neat .Net Stuff

This snippet shows two cool things. The Threadpool which can be used for arbitrary tasks, and an anonymous method, which allows the programmer to define throwaway, single use methods.

using System.Threading;
ThreadPool.QueueUserWorkItem(new WaitCallback(delegate(Object state) {
//This block will run in a separate thread!
//And not block your main program. W00t!

No comments:

Popular Posts