Click here to Skip to main content
15,910,083 members
Home / Discussions / C#
   

C#

 
GeneralRe: Please check only that lines which are commented AND IGNORE REST Pin
N a v a n e e t h18-Jul-08 3:05
N a v a n e e t h18-Jul-08 3:05 
GeneralRe: Please check only that lines which are commented AND IGNORE REST Pin
Mogaambo18-Jul-08 3:14
Mogaambo18-Jul-08 3:14 
QuestionAsynchronous call of a dynamically loaded method? Pin
matthias s.18-Jul-08 1:14
matthias s.18-Jul-08 1:14 
AnswerRe: Asynchronous call of a dynamically loaded method? Pin
N a v a n e e t h18-Jul-08 1:34
N a v a n e e t h18-Jul-08 1:34 
GeneralRe: Asynchronous call of a dynamically loaded method? Pin
matthias s.18-Jul-08 1:47
matthias s.18-Jul-08 1:47 
GeneralRe: Asynchronous call of a dynamically loaded method? Pin
N a v a n e e t h18-Jul-08 2:03
N a v a n e e t h18-Jul-08 2:03 
GeneralRe: Asynchronous call of a dynamically loaded method? Pin
matthias s.18-Jul-08 2:59
matthias s.18-Jul-08 2:59 
GeneralRe: Asynchronous call of a dynamically loaded method? Pin
N a v a n e e t h18-Jul-08 3:14
N a v a n e e t h18-Jul-08 3:14 
matthias s. wrote:
where do I put my parameters (the info object takes a JobInfo parameter) in there and what is the userState object used for?


Well, you need to pass parameter to the Invoke(), right ? You could probably right an inner class and pass this classes instance to the user state, I mean as parameter to the thread's Start() method.
private class DataCarrier
{
   JobInfo JobInfoInstance { get; set; }
   WaitHandle Handle { get; set; }

   DataCarrier(JobInfo info,WaitHandle handle){
      this.JobInfoInstance = info;
      this.Handle = handle;
   }
}
You can modify the above said method like
WaitHandle[] waitHandles = new WaitHandle[methods.Length];
for(int i = 0;i < methods.Length; i++ )
{
     waitHandles[i] = new AutoResetEvent(false);
     MethodInfo info = methods[i];
     DataCarrier carrier = new DataCarrier(JobInfoInstance,waitHandles[i]);
     new Thread(delegate(object userState)
     {
           DataCarrier c = userState as DataCarrier;
           // use c.JobInfoInstance here
           info.Invoke();
           c.Handle.Set();
     }).Start(carrier);
}
WaitHandle.WaitAll(waitHandles); // waits for all wait handles to set
// when control reaches here, all methods will have finished executing


All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia

How to use google | Ask smart questions

GeneralRe: Asynchronous call of a dynamically loaded method? Pin
matthias s.18-Jul-08 3:52
matthias s.18-Jul-08 3:52 
GeneralRe: Asynchronous call of a dynamically loaded method? Pin
N a v a n e e t h18-Jul-08 17:17
N a v a n e e t h18-Jul-08 17:17 
QuestionUsing MIRR function in c# Pin
sumit703418-Jul-08 0:16
sumit703418-Jul-08 0:16 
AnswerRe: Using MIRR function in c# Pin
CPallini18-Jul-08 0:32
mveCPallini18-Jul-08 0:32 
GeneralRe: Using MIRR function in c# Pin
sumit703418-Jul-08 0:38
sumit703418-Jul-08 0:38 
GeneralYou are welcome. Pin
CPallini18-Jul-08 0:41
mveCPallini18-Jul-08 0:41 
QuestionSerialPort and data received event Pin
kildareflare18-Jul-08 0:02
kildareflare18-Jul-08 0:02 
AnswerRe: SerialPort and data received event Pin
kildareflare18-Jul-08 1:01
kildareflare18-Jul-08 1:01 
GeneralRe: SerialPort and data received event Pin
Luc Pattyn18-Jul-08 1:38
sitebuilderLuc Pattyn18-Jul-08 1:38 
QuestionCan any body Tell me about 64 bit Pin
wasimsharp17-Jul-08 23:46
wasimsharp17-Jul-08 23:46 
AnswerRe: Can any body Tell me about 64 bit Pin
windhopper17-Jul-08 23:54
windhopper17-Jul-08 23:54 
GeneralRe: Can any body Tell me about 64 bit Pin
wasimsharp18-Jul-08 0:10
wasimsharp18-Jul-08 0:10 
QuestionConsume a webservice in a WebApplicationnew Pin
AS@1317-Jul-08 23:37
AS@1317-Jul-08 23:37 
AnswerRe: Consume a webservice in a WebApplicationnew Pin
N a v a n e e t h17-Jul-08 23:43
N a v a n e e t h17-Jul-08 23:43 
QuestionRe: Consume a webservice in a WebApplicationnew Pin
AS@1317-Jul-08 23:52
AS@1317-Jul-08 23:52 
AnswerRe: Consume a webservice in a WebApplicationnew Pin
enginço18-Jul-08 0:03
enginço18-Jul-08 0:03 
QuestionRe: Consume a webservice in a WebApplicationnew Pin
AS@1318-Jul-08 0:11
AS@1318-Jul-08 0:11 

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.