Datasheet
8
Part I: Design Strategies
Anonymous methods make it possible to create applications that run faster and require less code as
well. An anonymous method is literally a method that has no name. The method appears in-line in place
of the usual method reference. Using anonymous methods can also make it easier to debug the code
because the code appears in-line where the developer can easily see it during a debugging session.
In some cases, you want to place an interface defi nition in multiple fi les. Unlike other .NET languages,
C# lets you use the
partial keyword with:
class ❑
struct ❑
interface ❑
Method names ❑
Sometimes you want to make class code available without requiring the developer to create an instance
of the class. C# supports a static class for this purpose. For example, a math class may not have any
properties or state information to maintain, so a static class works just fi ne. In this case, all members
of the class are also static, which means you can access them directly. (A Visual Basic module is a close
cousin of this feature.)
You’ll also fi nd a few coding niceties in C#. For example, C# uses the
= operator for assignment and the
== operator for comparison. Using different symbols for each purpose makes their use clearer in your
code and helps avoid potential misinterpretations.
Exploding Developer Mind Share
At one time, most developers acknowledged that Visual Basic held a surprising lead in languages that
most developers would know. However, C# seems to be gathering an increasing level of developer mind
share and has possibly overtaken Visual Basic as the modern favorite. According to a Visual Studio maga-
zine survey (
http://visualstudiomagazine.com/columns/article.aspx?editorialsid=2333),
41 percent of the developers polled now use C#, contrasted to 34 percent for Visual Basic. Of course, this
is only one survey, but other hints abound. For example, Microsoft often makes examples available for
new technologies in C#, rather than Visual Basic as it did in the past.
For the purposes of this book, it doesn’t matter whether C# or Visual Basic is the new developer mind-
share king. What does matter is that using C# means you can fi nd the developers you need for a project
with greater ease when using either C# or Visual Basic than when using other languages. In short, using
C# provides a big advantage in locating the specifi c skills your project requires. Given that many of the
new C# developers on the market are converts from Visual Basic, you may very well fi nd that the C#
developer you hire to help with a project also has Visual Basic knowledge, giving you essentially two
developers for the price of one.
Understanding the Defi ciencies
Every programming language has a defi ciency or two. The very act of addressing one need necessarily
means that the language isn’t addressing another requirement. C# tends to provide lower level func-
tionality than Visual Basic, but it isn’t quite as low level as C++. Consequently, C# tends to cover the
middle ground of programming well, but you may fi nd areas where you really need another language
to get the desired result. The following sections describe some C# defi ciencies you should consider
when you begin developing your language environment.
15962c01.indd 815962c01.indd 8 1/23/09 5:45:00 AM1/23/09 5:45:00 AM