Click here to Skip to main content
15,892,697 members
Home / Discussions / C#
   

C#

 
GeneralRe: How to convert a float to a 4 byte array. Pin
HAHAHA_NEXT16-Jan-04 10:12
HAHAHA_NEXT16-Jan-04 10:12 
GeneralSqlParameter.IsNullable Pin
Shaun Becker15-Jan-04 10:20
Shaun Becker15-Jan-04 10:20 
GeneralRe: SqlParameter.IsNullable Pin
Shaun Becker15-Jan-04 10:25
Shaun Becker15-Jan-04 10:25 
GeneralWeb Service Problem and Session Pin
Mazdak15-Jan-04 10:19
Mazdak15-Jan-04 10:19 
GeneralRe: Web Service Problem and Session Pin
Heath Stewart16-Jan-04 3:56
protectorHeath Stewart16-Jan-04 3:56 
GeneralRe: Web Service Problem and Session Pin
Mazdak16-Jan-04 4:19
Mazdak16-Jan-04 4:19 
GeneralRe: Web Service Problem and Session Pin
Heath Stewart16-Jan-04 4:56
protectorHeath Stewart16-Jan-04 4:56 
GeneralRe: Web Service Problem and Session Pin
Mazdak16-Jan-04 5:26
Mazdak16-Jan-04 5:26 
GeneralRe: Web Service Problem and Session Pin
Mazdak16-Jan-04 6:57
Mazdak16-Jan-04 6:57 
GeneralRe: Web Service Problem and Session Pin
Heath Stewart16-Jan-04 6:59
protectorHeath Stewart16-Jan-04 6:59 
Generalhttp remote file timestamp Pin
elraton15-Jan-04 9:29
elraton15-Jan-04 9:29 
GeneralRe: http remote file timestamp Pin
Heath Stewart15-Jan-04 9:55
protectorHeath Stewart15-Jan-04 9:55 
QuestionDoc / View i C# ? Pin
anderslundsgard15-Jan-04 7:25
anderslundsgard15-Jan-04 7:25 
AnswerRe: Doc / View i C# ? Pin
Heath Stewart15-Jan-04 9:53
protectorHeath Stewart15-Jan-04 9:53 
AnswerRe: Doc / View i C# ? Pin
Eric Gunnerson (msft)15-Jan-04 13:10
Eric Gunnerson (msft)15-Jan-04 13:10 
GeneralMetafile too small Pin
Torsch15-Jan-04 6:31
Torsch15-Jan-04 6:31 
GeneralParameters & Threading Pin
Anonymous15-Jan-04 4:56
Anonymous15-Jan-04 4:56 
GeneralRe: Parameters & Threading Pin
Heath Stewart15-Jan-04 6:49
protectorHeath Stewart15-Jan-04 6:49 
Async methods are a good way to start new threads and you don't have to worry about implementing in the callback - just use an empty method.

You could also use a ThreadPool, which uses the QueueUserWorkItem to thread a WaitCallback but that can also take an Object as a state variable that is passed to the WaitCallback - this could be anything from a single object to an array or list of arguments.

If you really don't want to use either of these, you should design a class that takes the parameters you want in the constructor or some properties and then uses an instance method on that class in the ThreadStart delegate. The delegate can then access all the fields in which those arguments are stored, like so:
public class MyThread
{
  private int i;
  private string s;
  public MyThread(int i, string s)
  {
    this.i = i;
    this.s = s;
    new Thread(new ThreadStart(this.Start)).Start();
  }
  private void Start()
  {
    Console.WriteLine("{0}, {1}", this.i, this.s);
  }
}


 

-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
Generalwindows service question Pin
Visuall15-Jan-04 4:55
Visuall15-Jan-04 4:55 
GeneralRe: windows service question Pin
Heath Stewart15-Jan-04 6:41
protectorHeath Stewart15-Jan-04 6:41 
GeneralADO.Net synchronization Pin
Judah Gabriel Himango15-Jan-04 4:49
sponsorJudah Gabriel Himango15-Jan-04 4:49 
GeneralRe: ADO.Net synchronization Pin
Not Active15-Jan-04 5:42
mentorNot Active15-Jan-04 5:42 
GeneralRe: ADO.Net synchronization Pin
Judah Gabriel Himango15-Jan-04 6:01
sponsorJudah Gabriel Himango15-Jan-04 6:01 
GeneralRe: ADO.Net synchronization Pin
Not Active15-Jan-04 6:28
mentorNot Active15-Jan-04 6:28 
GeneralRe: ADO.Net synchronization Pin
Judah Gabriel Himango15-Jan-04 8:34
sponsorJudah Gabriel Himango15-Jan-04 8:34 

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.