So far I have been trying to master threading by immediately implementing threads in my project. And I have been trying to do that for a long time. But this hasn't resulted any results, nor gave me any experience with threading. The only thing that the attempting gave me is the impression that threading in C# has many important refinements.
I couldn't find any simple exercises about threading. I'm searching for exercises where you have to make different simple console applications. I am searching for simple exercises so I can get an idea of how things work when working with threads and master that idea. I have seen a book of programming exercises with difficulty that gets harder as the problem's number gets bigger. I am searching for something similar. Afterwards I will continue with more complicated stuff and try to add threads in my project (which is made with Windows Forms).
Where can I find exercises/book of exercises about threading in C#?
EDIT:
I am NOT looking for any tutorials- I can find them myself. I am searching for exercises and exercises only. If there are no such exercises, please, tell me.
In the real sense it has no meaning or full form. It was developed by Dennis Ritchie and Ken Thompson at AT&T bell Lab. First, they used to call it as B language then later they made some improvement into it and renamed it as C and its superscript as C++ which was invented by Dr.
" " C is a computer programming language. That means that you can use C to create lists of instructions for a computer to follow. C is one of thousands of programming languages currently in use.
C programming language is a machine-independent programming language that is mainly used to create many types of applications and operating systems such as Windows, and other complicated programs such as the Oracle database, Git, Python interpreter, and games and is considered a programming foundation in the process of ...
Simple exercises:
1) change code that works (learn by example)
2) answer questions on SO (learn by teaching)
Joseph Albahari has a great article called Threading in C#. This is really cool blog post about start to learn for threading in C#. Joseph clearly explained:
And check this out article from Codeproject.
You can create and start a new thread by instantiating a Thread
object and calling
its Start method. The simplest constructor for Thread takes a ThreadStart
delegate:
a parameterless method indicating where execution should begin.
using System;
using System.Threading;
class ThreadTest
{
static void Main()
{
Thread t = new Thread (WriteY); // Kick off a new thread
t.Start(); // running WriteY()
// Simultaneously, do something on the main thread.
for (int i = 0; i < 1000; i++) Console.Write ("x");
}
static void WriteY()
{
for (int i = 0; i < 1000; i++) Console.Write ("y");
}
}
// Output:
xxxxxxxxxxxxxxxxyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxyyyyyyyyyyyyy
yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
yyyyyyyyyyyyyxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
...
If you want to learn threading deeply get a copy of C# 4.0 in a Nutshell
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With