Code

The following articles come with code downloads. To get the code downloads, click on the article titles, then click on the Code Download button.



Working Effectively with Exceptions

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.

Targeting Azure Storage

Learn how to store and retrieve binary large objects in the cloud with Azure's RESTful Storage API.

Generic Covariance and Contravariance in C# 4.0

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.

Silverlight 3 Enables Data-Driven App Dev

The new DataForm control and enhanced support for data-driven applications make it possible for developers to deliver line-of-business applications to any user with a Silverlight-enabled Web browser.

Make Your Code Clear

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.

Build and Debug Web Parts with SharePoint Extensions

Visual Studio 2008 Extensions for SharePoint makes developing and testing Web Parts almost easy, provided you install it correctly.

XML Literals, WCF and LINQ

Learn how to create powerful templates that can be called from both client- and server-side code.

Create Anonymous Types

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.

Use Iterators in VB Now

Iterators are a crucial part of modern programming, not least because they provide the basis for collection traversal using For Each loops. Language Integrated Query (LINQ) adds to the importance of iterators, as iterators are the source of IEnumerable(Of T) that forms the backbone of LINQ. Learn how to take advantage of them in your code with several different techniques for creating your own iterators in VB.

Use Lambda Expressions for Abstract Delegates

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?

Speed O/R Mapping with LINQ to SQL

LINQ to SQL continues to be a top contender in the .NET object/relational mapping tool market despite Microsoft's promotion of the Entity Framework as one of the "Pillars of SQL Server 2008: Dynamic Development."

Combine Generics and Functional Programming

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.

Create a Data-Driven Messaging System

Hard-coded messages don't scale well, and .NET's inherent error messages are user-unfriendly. Learn how to create a more scalable and user-friendly data-driven messaging system.

Achieve Low-Impact Reuse

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.

Customize Code Generation in EF

Learn how to exclude attributes from the code that Entity Framework generates for you automatically.

Subscribe on YouTube