Optional and named parameters were added to the C# language for COM and Office interoperability, but these features are actually useful in a variety of ways.
Exceptions are a way of life in the .NET world. You must follow the rules to make your classes easy to use for other developers. Conforming to the standards will make everyone's life easier.
Covariance and contravariance are precise terms that describe which conversions are safe on parameters and return types. Learn practical definitions for those terms, what new constructs will be supported in C# 4.0 and how to live with the current limitations until Visual Studio 2010 is adopted by your organization.
There are multiple ways to solve every problem. Strive for code that communicates your intent and makes your meaning clear for every developer who uses it.
Taking a careful look at the capabilities the compiler gives to anonymous types provides an excellent tutorial on what you should consider when you create your types -- including whether they are classes or structs.
Lambda expressions are nothing more than convenient syntax for delegates. So why can't you use them where the Framework expects a delegate? And more importantly, what can you do about it?
Chances are C# is not your first programming language. Here are several tips that can help you leverage C# better if you already know VB.NET.
Mixing generics and functional programming simplifies writing some extensibility libraries tremendously. For example, combining these techniques makes it easy to create a generic Undo library.
Sometimes it makes more sense to separate functionality you use repeatedly into its own component. Learn how to create a special command-line processing component.
Take advantage of C#'s Item Templates to automate tasks that you find yourself having to perform on a regular basis.
Language features aren't good or bad. The choice of language feature depends on what you're doing. In this issue, we dive into the methods vs. properties debate.
You probably write a lot of code to test object state. A better approach might be to make your objects report their own state.
Take advantage of new features in C# 3.0 that let you treat code as data -- and save time over more traditional, imperative approaches to programming.
The latest iteration of C# introduces a host of new language features, most of which were created to enable functionality that you see in the .NET Framework 3.5's LINQ.
- By Kathleen Dollard
Developers are accustomed to thinking of an object as either existing or not, but the truth is the initialization process is complex enough that this isn't always so.
Learn how to initialize objects properly and avoid small missteps that can lead to big problems when creating and initializing objects.