The Parallel class in NETXPF.Library allows you to run loops in parallel on systems that have multiple CPUs without requiring .NET 4.0.

Examples of usage:

//here is an example that prints strings in parallel
List<string> myListOfStrings = new List<string>(new string[] { "a", "b", "c" } );
NETXPF.Library.Parallel.ForEach<string>(myListOfStrings, (str) => {
  Console.WriteLine(str);
});
//here is an example that does the same thing as the previous example but with a 'for' loop instead of 'foreach'
NETXPF.Library.Parallel.For(0, myListOfStrings.Length, (i) => {
  Console.WriteLine(myListOfStrings[i]);
});

Last edited Oct 25, 2010 at 7:09 AM by dacris, version 5

Comments

No comments yet.