Click here to Skip to main content
15,901,373 members
Home / Discussions / C#
   

C#

 
AnswerRe: C# and XML Question Pin
LongRange.Shooter18-Apr-06 10:20
LongRange.Shooter18-Apr-06 10:20 
Questionpassing array byval versus byref Pin
bnathvbdotnet18-Apr-06 4:08
bnathvbdotnet18-Apr-06 4:08 
AnswerRe: passing array byval versus byref Pin
Judah Gabriel Himango18-Apr-06 4:50
sponsorJudah Gabriel Himango18-Apr-06 4:50 
AnswerRe: passing array byval versus byref Pin
Robert Rohde18-Apr-06 5:23
Robert Rohde18-Apr-06 5:23 
AnswerRe: passing array byval versus byref Pin
Guffa18-Apr-06 6:02
Guffa18-Apr-06 6:02 
QuestionI/O Threading Pin
eric_tran18-Apr-06 3:59
eric_tran18-Apr-06 3:59 
AnswerRe: I/O Threading Pin
Judah Gabriel Himango18-Apr-06 4:52
sponsorJudah Gabriel Himango18-Apr-06 4:52 
AnswerRe: I/O Threading Pin
Robert Rohde18-Apr-06 5:43
Robert Rohde18-Apr-06 5:43 
I'm not directly getting what you are trying to achieve but if the only problem is that you can pass only one parameter to your thread function you could just pack more info into that one object parameter:
public void StartMyThread() 
{
   int param1 = 0;
   bool param2 = false;
   string param3 = "Hello World!";
   t2.Start(new object[] { param1, param2, param3 } );
}

public static void MyThreadFunction(object paramAll)
{
   object[] paramArray = (object[])paramAll;
   int param1 = (int)paramArray[0];
   int param2 = (bool)paramArray[1];
   int param3 = (string)paramArray[2];
}

This works because an object array is also an objectand thus you can stuff as many parameters as you want into the call.
A bit more typesafe variant would be:
public struct ThreadFuncParameters
{
   public int Param1;
   public bool Param2;
   public string Param3;
}

public void StartMyThread() 
{
   ThreadFuncParameters params = new ThreadFuncParameters();
   params.Param1 = 0;
   params.Param2 = false;
   params.Param3 = "Hello World!";
   t2.Start(params);
}

public static void MyThreadFunction(object paramAll)
{
   ThreadFuncParameters params = (ThreadFuncParameters)paramAll;
   int param1 = params.Param1;
   int param2 = params.Param2;
   int param3 = params.Param3;
}

I would prefer that way because you wouldn't cast so often as in the first example and casts are always a source for runtime exceptions.
GeneralRe: I/O Threading Pin
eric_tran19-Apr-06 0:31
eric_tran19-Apr-06 0:31 
GeneralRe: I/O Threading Pin
eric_tran19-Apr-06 1:50
eric_tran19-Apr-06 1:50 
GeneralRe: I/O Threading Pin
Robert Rohde19-Apr-06 4:54
Robert Rohde19-Apr-06 4:54 
QuestionebXML message with C# Windows App Pin
Paul Brower18-Apr-06 2:54
Paul Brower18-Apr-06 2:54 
Questionhow to disable tree node in a dataset Pin
A4ad18-Apr-06 2:35
A4ad18-Apr-06 2:35 
AnswerRe: how to disable tree node in a dataset Pin
Robert Rohde18-Apr-06 5:47
Robert Rohde18-Apr-06 5:47 
GeneralRe: how to disable tree node in a dataset Pin
A4ad18-Apr-06 23:42
A4ad18-Apr-06 23:42 
Questionselect all the text in the textbox c# winform Pin
fady_sayegh18-Apr-06 2:19
fady_sayegh18-Apr-06 2:19 
AnswerRe: select all the text in the textbox c# winform Pin
Ed.Poore18-Apr-06 3:57
Ed.Poore18-Apr-06 3:57 
AnswerRe: select all the text in the textbox c# winform Pin
Eric Dahlvang18-Apr-06 4:52
Eric Dahlvang18-Apr-06 4:52 
AnswerRe: select all the text in the textbox c# winform Pin
Josh Smith18-Apr-06 5:25
Josh Smith18-Apr-06 5:25 
GeneralRe: select all the text in the textbox c# winform Pin
fady_sayegh18-Apr-06 6:27
fady_sayegh18-Apr-06 6:27 
AnswerRe: select all the text in the textbox c# winform Pin
LongRange.Shooter18-Apr-06 10:31
LongRange.Shooter18-Apr-06 10:31 
QuestionC# and Crystal Report Pin
Abhijeet Ballal18-Apr-06 1:16
Abhijeet Ballal18-Apr-06 1:16 
Questionworking with strings Pin
shezh18-Apr-06 0:42
shezh18-Apr-06 0:42 
AnswerRe: working with strings Pin
alexey N18-Apr-06 0:51
alexey N18-Apr-06 0:51 
AnswerRe: working with strings Pin
Stefan Troschuetz18-Apr-06 0:52
Stefan Troschuetz18-Apr-06 0:52 

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.