Click here to Skip to main content
15,887,434 members
Home / Discussions / C#
   

C#

 
GeneralRe: C# App without App.Config Pin
shiftyninja11-Dec-08 10:22
shiftyninja11-Dec-08 10:22 
AnswerRe: C# App without App.Config Pin
blackjack215011-Dec-08 9:56
blackjack215011-Dec-08 9:56 
GeneralRe: C# App without App.Config Pin
Christian Graus11-Dec-08 10:04
protectorChristian Graus11-Dec-08 10:04 
GeneralRe: C# App without App.Config Pin
shiftyninja11-Dec-08 10:18
shiftyninja11-Dec-08 10:18 
GeneralRe: C# App without App.Config Pin
Christian Graus11-Dec-08 12:43
protectorChristian Graus11-Dec-08 12:43 
GeneralRe: C# App without App.Config Pin
shiftyninja11-Dec-08 10:23
shiftyninja11-Dec-08 10:23 
AnswerRe: C# App without App.Config Pin
#realJSOP11-Dec-08 10:44
mve#realJSOP11-Dec-08 10:44 
QuestionPassing parameters to anonymous functions in threads Pin
Andreas Saurwein11-Dec-08 8:11
Andreas Saurwein11-Dec-08 8:11 
All right, that sounds quite weird, but that's the way it works:

foreach(something in somethingelse)
{
  add_a_job_to_the_threadpool(delegate { myFunction(something.Key, something.Value); } );
}


Right, so what obviously happens here is that ALL calls to myFunction() receive the same parameters since something is passed as reference. How do I get this done as values or at least as references to the value, not to the iterator. I already tried to use a struct (which would pass by value) but the something is actually a dictionary<string,> and even wrapping them in a struct doesnt change much.
There must be a better way then copying them before passing to the delegate.

Anyone?
AnswerRe: Passing parameters to anonymous functions in threads Pin
Christian Graus11-Dec-08 8:29
protectorChristian Graus11-Dec-08 8:29 
GeneralRe: Passing parameters to anonymous functions in threads Pin
Andreas Saurwein11-Dec-08 8:41
Andreas Saurwein11-Dec-08 8:41 
GeneralRe: Passing parameters to anonymous functions in threads Pin
Christian Graus11-Dec-08 8:54
protectorChristian Graus11-Dec-08 8:54 
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 
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 

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.