Jump to content

So I want to iterate trought a dicitonary using a parallel for each.

Which is the source collection and which is the item ?

My code is like this:

List <int> procura(Dictionary <int, string> dicionario, string padrao){	List <int> rout = new List<int>;	Parallel.ForEach(dicionario, d=> 	{		bool result  = Task.Factory.StartNew(() =>contem(d.Item2,padrao);		if(result == true)		{			rout.add(d.Item1);		}	});	return rout;}

I am using this as reference:

https://msdn.microsoft.com/en-us/library/dd537608.aspx

Link to comment
https://linustechtips.com/topic/344658-parallel-for-each-confusion-c/
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×