Threading in java vs C#

Posted by ffayyaz on Stack Overflow See other posts from Stack Overflow or by ffayyaz
Published on 2012-09-05T21:29:03Z Indexed on 2012/09/05 21:38 UTC
Read the original article Hit count: 135

Filed under:
|
|

I need a little confirmation over something i am confused at . I know how threads work in java.

new DialList(string a , string b).start(); // where DialList is a class

public class DialList extends Thread {
    public DialList(String a, string b) {
        FilePath = a; 
        ThreadLogFile = b"; 
    }

    public void run() {
        // some code to run in different thread
    }
}

Now i want to run same code in C# , Shall i put the code which is in run() into a method and do something like

 Thread t = new Thread (runcsharp);          // Kick off a new thread
 t.Start(); 
 static void runcsharp() {
     // code
 }

or is there some other way to do it ?

© Stack Overflow or respective owner

Related posts about c#

Related posts about multithreading