C# Corner

Simplify Background Threads

It requires a lot of plumbing to create, manage, and communicate with background threads. The System.ComponentModel.BackgroundWorker class already contains the functionality you need to follow best practices.

Write Code for a Multithreaded World

Multithreaded programming is difficult because context switches can happen any time. Here are a few techniques to mitigate the chance of failure.

Reduce Lines of Code With C# 3.0

You already know what those new features in C# 3.0 are doing because you do these same things in C# 2.0. Learn how C# 3.0 can reduce coding lines and improve readability by walking through a reverse migration.

Write Robust Exception-Handling Code

Thrown exceptions break the normal flow of execution in a program to report error conditions. A few simple techniques can help you preserve execution flow and give users and administrators the information they need to understand what went wrong.

Build Adapters for Reuse

You can save space and even time by compressing your persistent data store. The interesting trick is to provide this functionality by adapting your current algorithms, rather than completely replacing them.

Generics: Move Beyond Collections

Generics can solve many more problems than collections. Use generics to write code once and reuse it more easily.

Understand Variable Scoping and Definite Assignment

Learn how to scope your variables correctly, as well as the rules governing definite assignment in C#.

Upcoming Events

.NET Insight

Sign up for our newsletter.

I agree to this site's Privacy Policy.