Click here to Skip to main content
15,896,063 members
Home / Discussions / C#
   

C#

 
GeneralRe: Read only Outlookbar Pin
MoustafaS2-May-05 13:14
MoustafaS2-May-05 13:14 
GeneralUrl navigation Pin
Adnan Siddiqi2-May-05 10:42
Adnan Siddiqi2-May-05 10:42 
GeneralRe: Url navigation Pin
leppie2-May-05 14:57
leppie2-May-05 14:57 
QuestionCancellable operation -- recommended practice? Pin
Judah Gabriel Himango2-May-05 9:42
sponsorJudah Gabriel Himango2-May-05 9:42 
AnswerRe: Cancellable operation -- recommended practice? Pin
Marc Clifton2-May-05 10:56
mvaMarc Clifton2-May-05 10:56 
GeneralRe: Cancellable operation -- recommended practice? Pin
Judah Gabriel Himango2-May-05 11:03
sponsorJudah Gabriel Himango2-May-05 11:03 
QuestionPassing methods to ThreadStart - Possible? Pin
stan282-May-05 8:52
stan282-May-05 8:52 
AnswerRe: Passing methods to ThreadStart - Possible? Pin
Judah Gabriel Himango2-May-05 9:05
sponsorJudah Gabriel Himango2-May-05 9:05 
Yes, but not with Thread.Start (although you can in .NET 2.0, because Thread.Start will have overloads to take a ParameterizedThreadStart, which allows you to pass a System.Object parameter).

For .NET 1.x code, you have 2 options.

You could use the built-in .NET threadpool:

void SomeMethod(object parameter)
{
   // Assume we passed in an int[].
   int[] typedParam = (int[])parameter;
}

WaitCallback waitCallback = new WaitCallback(SomeMethod);
ThreadPool.QueueUserWorkItem(waitCallback, new int[]{1, 5});


Or you can define your own delegate (or use an existing one) that matches your desired method signature (i.e. has the correct number of parameters and the correct parameter types), then call delegate.BeginInvoke on it:

delegate void MethodWithTwoIntegers(int a, int b);

void SomeMethod(int a, int b)
{
}

MethodWithTwoIntegers myMethod = new MethodWithTwoIntegers(SomeMethod);
myMethod.BeginInvoke(5, 10, null, null);


Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Horrific Minnesota Radio
Judah Himango


AnswerRe: Passing methods to ThreadStart - Possible? Pin
Marc Clifton2-May-05 10:52
mvaMarc Clifton2-May-05 10:52 
AnswerRe: Passing methods to ThreadStart - Possible? Pin
leppie2-May-05 14:29
leppie2-May-05 14:29 
GeneralGeneric Hashtable Pin
Anonymous2-May-05 8:48
Anonymous2-May-05 8:48 
GeneralRe: Generic Hashtable Pin
Marc Clifton2-May-05 10:53
mvaMarc Clifton2-May-05 10:53 
GeneralRe: Generic Hashtable Pin
Anonymous3-May-05 5:09
Anonymous3-May-05 5:09 
GeneralRe: Generic Hashtable Pin
leppie2-May-05 14:46
leppie2-May-05 14:46 
GeneralOle Server Pin
BigAnyon2-May-05 5:58
BigAnyon2-May-05 5:58 
GeneralVisual style icons / bitmaps Pin
Anonymous2-May-05 5:45
Anonymous2-May-05 5:45 
GeneralRe: Visual style icons / bitmaps Pin
Judah Gabriel Himango2-May-05 7:05
sponsorJudah Gabriel Himango2-May-05 7:05 
GeneralRe: Visual style icons / bitmaps Pin
MoustafaS2-May-05 8:49
MoustafaS2-May-05 8:49 
GeneralEasy file I/O Pin
briggs_w2-May-05 4:58
briggs_w2-May-05 4:58 
GeneralRe: Easy file I/O Pin
Heath Stewart2-May-05 5:11
protectorHeath Stewart2-May-05 5:11 
GeneralRe: Easy file I/O Pin
Marc Clifton2-May-05 5:24
mvaMarc Clifton2-May-05 5:24 
General... also ... Pin
Marc Clifton2-May-05 5:26
mvaMarc Clifton2-May-05 5:26 
GeneralRe: Easy file I/O Pin
briggs_w5-May-05 5:50
briggs_w5-May-05 5:50 
GeneralAccess a flat file at http location Pin
mrinmayeek2-May-05 4:27
mrinmayeek2-May-05 4:27 
GeneralRe: Access a flat file at http location Pin
Heath Stewart2-May-05 5:12
protectorHeath Stewart2-May-05 5:12 

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.