Threading in C# is no big deal. It has the easiest implementation I've ever seen. First of all, you need to have a method that you want to execute on a different thread. For this instance, I'll put method called Calculate(). Now, this method has to be a void. However, it can take any amount of parameters. So, it can be:
public void Calculate()
or
public void Calculate(int x, int y)
Now that we know what to execute, we need to create a thread with this method. This is done by:
Thread t = new Thread(Calculate());
I can now run the thread by typing:
t.Start();
See Also: How do I do threaded programming in Java?
No comments:
Post a Comment