How To Thread in C#, Part I

One of my New Year wishes for this coming year was that the standard committees wouldagree on threading classes for the C++ language. This limitation of the C++ languagestandard means that I have to rewrite my threading library each time I start a new job witha new company. I've always wished there was a standard threading library that I could usewherever I go.

Fortunately, C# does not have this disadvantage. Right from the get go, the languageinherits an entire set of threading classes from the dotNet framework. The dotNet namespaces includes 14 utility classes, 4 exception classes, 2structures, 6 delegates and 3 enumerations. I'll present most of these in this article.

Intermediate Level

This article is written for the intermediate and senior C# developer. Working knowledgeof the C# programming language and dotNet framework is assumed. The article waswritten with a Beta version of VS.NET and associated documentation. Changes, althoughnot anticipated, might occur before final release of VS.NET that invalidate portions of thisarticle.

Creating Threads

Creating a thread in C# is close to trivial, but not quite. The only non-trivial thing aboutcreating a thread is dotNet delegate-classes. Let me explain in few words what is adelegate class. The delegate is a wrapper around a code construct in the dotNet. The codeconstruct could be an object instance, an instance method or a static method. Delegatesare used when you want to pass one of the three code constructs as a parameter toanother method.

Twitter Digg Delicious Stumbleupon Technorati Facebook Email

No comments yet... Be the first to leave a reply!