Threading, simply put, is a way for your program to do multiple things at once.

Sort of like driving and talking on the cell/mobile phone at the same time.

Yes you can do both, but they can cause bad things to happens.  Like driving through red lights, or having your computer freeze on you.

Coincidently, I use threading in my Lotus Notes Mail Exporter (LNME) program.
Lotus-Notes-Mail_exporter-4

The part which does the actual mail message exporting, runs in it’s own thread.

I needed to use threading as I wanted the program screen to update in real time.  Before I implemented a BackGroundWorker thread, the program wasn’t able to update the Status section (highlighted above).  Using threading, it was simple.

But it was difficult to implement, because most programming examples for threading don’t explain the WHY of using a particular thread techique.
So I made a guess to use a BackGroundWorker Thread.

Which turned out ok.

Though, had I seen Joseph Albahari’s website, and the section on Threading in C#, I might have done it differently.

Why?

Well Joseph has written a guide to Threading in C# which forms THE reference to threading.  It’s packed full of information, and I wish I had it when I was starting to write LNME.

Go there, and have a read.

Bookmark and Share