I take it the code you posted is just an example. If that is the case one way would be to use Parallel class.
First define an object variable on the class level
object _lockobject = new object();
And try something like the following
string[] param = { "US", "UK", "CND" };
System.Collections.ArrayList getData = new System.Collections.ArrayList();
System.Diagnostics.Stopwatch watch = new System.Diagnostics.Stopwatch();
watch.Reset();
watch.Start();
for (int i = 0; i < param.Length; i++) {
getData.AddRange(GetData(param[i]));
}
watch.Stop();
System.Diagnostics.Debug.WriteLine(string.Format("Sequential execution took {0}", watch.Elapsed.ToString()));
watch.Reset();
watch.Start();
System.Threading.Tasks.Parallel.For(0, param.Length, (i) => {
System.Collections.ArrayList partialresult;
partialresult = GetData(param[i]);
lock (this._lockobject) {
getData.AddRange(partialresult);
}
});
watch.Stop();
System.Diagnostics.Debug.WriteLine(string.Format("Parallel execution took {0}", watch.Elapsed.ToString()));