Click here to Skip to main content
15,888,984 members
Home / Discussions / C#
   

C#

 
GeneralRe: Passing parameters to anonymous functions in threads Pin
Andreas Saurwein11-Dec-08 9:00
Andreas Saurwein11-Dec-08 9:00 
GeneralRe: Passing parameters to anonymous functions in threads Pin
Christian Graus11-Dec-08 9:12
protectorChristian Graus11-Dec-08 9:12 
AnswerRe: Passing parameters to anonymous functions in threads Pin
led mike11-Dec-08 8:33
led mike11-Dec-08 8:33 
GeneralRe: Passing parameters to anonymous functions in threads Pin
Andreas Saurwein11-Dec-08 8:38
Andreas Saurwein11-Dec-08 8:38 
GeneralRe: Passing parameters to anonymous functions in threads Pin
led mike11-Dec-08 8:43
led mike11-Dec-08 8:43 
GeneralRe: Passing parameters to anonymous functions in threads Pin
led mike11-Dec-08 8:58
led mike11-Dec-08 8:58 
GeneralRe: Passing parameters to anonymous functions in threads Pin
Andreas Saurwein11-Dec-08 9:03
Andreas Saurwein11-Dec-08 9:03 
GeneralRe: Passing parameters to anonymous functions in threads Pin
led mike11-Dec-08 10:35
led mike11-Dec-08 10:35 
Andreas Saurwein Franci Gonçalves wrote:
how to circumvent the situation.

Possibly, if you had described the situation accurately. As it is I can't make any sense of what you posted.

foreach(something in somethingelse)
that loop is bogus, foreach(type instance <span style="color: Blue;">in</span> collection), as is your definition of something versus how you claim to use it.
Andreas Saurwein Franci Gonçalves wrote:
the something is actually a dictionary<string,><string,>

If something is a Dictionary<string, whatever> then there is no something.Key nor something.Value
add_a_job_to_the_threadpool(delegate { myFunction(something.Key, something.Value); } );
I have no idea what your requirements are nor what the existing code structure is since you obviously did not post it. Makes it rather difficult to offer any lines of code that could be helpful.

Since you appear to be struggling with how to pass the state information to each thread context. Making the following major assumptions I would say:
foreach(string skey in somethingDictionary.Keys)
  add( delegate{ myFunction( skey, somethingDictionary); } );
myFunction can then obtain it's state information, or whatever it is, from the dictionary using the key


led mike

GeneralRe: Passing parameters to anonymous functions in threads Pin
Andreas Saurwein11-Dec-08 10:43
Andreas Saurwein11-Dec-08 10:43 
GeneralRe: Passing parameters to anonymous functions in threads Pin
led mike11-Dec-08 11:34
led mike11-Dec-08 11:34 
GeneralRe: Passing parameters to anonymous functions in threads Pin
Andreas Saurwein11-Dec-08 11:42
Andreas Saurwein11-Dec-08 11:42 
GeneralRe: Passing parameters to anonymous functions in threads Pin
led mike11-Dec-08 11:56
led mike11-Dec-08 11:56 
GeneralRe: Passing parameters to anonymous functions in threads Pin
Andreas Saurwein11-Dec-08 12:31
Andreas Saurwein11-Dec-08 12:31 
GeneralRe: Passing parameters to anonymous functions in threads Pin
led mike16-Dec-08 10:19
led mike16-Dec-08 10:19 
GeneralRe: Passing parameters to anonymous functions in threads Pin
Andreas Saurwein16-Dec-08 11:24
Andreas Saurwein16-Dec-08 11:24 
GeneralRe: Passing parameters to anonymous functions in threads Pin
Ben Fair11-Dec-08 8:41
Ben Fair11-Dec-08 8:41 
GeneralRe: Passing parameters to anonymous functions in threads Pin
led mike11-Dec-08 8:44
led mike11-Dec-08 8:44 
AnswerRe: Passing parameters to anonymous functions in threads Pin
Nicholas Butler11-Dec-08 10:48
sitebuilderNicholas Butler11-Dec-08 10:48 
GeneralRe: Passing parameters to anonymous functions in threads Pin
Andreas Saurwein11-Dec-08 10:58
Andreas Saurwein11-Dec-08 10:58 
QuestionWeb analytic application Pin
Maverickcool11-Dec-08 7:08
Maverickcool11-Dec-08 7:08 
AnswerRe: Web analytic application Pin
led mike11-Dec-08 8:03
led mike11-Dec-08 8:03 
QuestionGridView ? Pin
tim_gunning11-Dec-08 6:34
tim_gunning11-Dec-08 6:34 
AnswerRe: GridView ? Pin
Lev Danielyan11-Dec-08 6:43
Lev Danielyan11-Dec-08 6:43 
QuestionImport Data into Access DataTable from another Access Database Pin
polishprogrammer11-Dec-08 5:54
polishprogrammer11-Dec-08 5:54 
QuestionYouTube API with C# Pin
bmx463711-Dec-08 4:40
bmx463711-Dec-08 4:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.