Converting a VBA Macro to C# 4.0

I’ve talked a lot about improved COM interop in C# 4.0 and how much easier it is now to work with Office applications. This time I want to share some tips and tricks on how you can convert Visual Basic for Applications (VBA) macros to C# 4.0 by using Office 2010 and Visual Studio 2010…. Read more

Blocking Collection and the Producer-Consumer Problem

This time I want to discuss features that belong to the new System.Collections.Concurrent namespace in the.NET Framework 4. When you design parallel applications, you often need thread-safe data storage as well as some mechanism of sending messages between tasks. Once again, this post will touch on just the basics and the most common problems a… Read more

C# 4.0 PowerPoint Presentations

Alexandru Ghiondea from the C# team created an excellent deck of slides that he used at Microsoft Days 2010 in Bulgaria. The C# team reused the deck several times for User Groups’ presentations and talks. If you are planning a talk at your User Group, feel free to download. And even if you are not,… Read more

Parallel Programming: Task Cancellation

In this post, which is the third one in my parallel programming introduction series, I want to show how you can cancel parallel operations when working with the Task Parallel Library (TPL). I’m going to modify the program that I started in the previous posts. By the way, here’s the full list of posts in… Read more

Parallel Programming: Task Schedulers and Synchronization Context

Thanks to everyone who provided feedback on my previous post Parallel Programming in .NET Framework 4: Getting Started. As promised, I am continuing the series. This time, let’s go a little bit deeper and talk about task schedulers, synchronization context, tasks that return values, and some other cool features of the Task Parallel Library (TPL)…. Read more

Parallel Programming in .NET Framework 4: Getting Started

With this post I want to start a series devoted to the new parallel programming features in .NET Framework 4 and introduce you the Task Parallel Library (TPL). Update. The list of posts in this series: Getting Started (this post) Task Schedulers and Synchronization Context Task Cancellation Blocking Collection and the Producer-Consumer Problem I have… Read more

New IDE Features in Visual Studio 2010 for C# Developers

After a quick review of C# language features, let’s do the same for the IDE improvements. So, what’s in there for C# developers? Generate From Usage This feature greatly improves Visual Studio support for test-driven development (TDD). However, it is useful even if you don’t use TDD at all. It might increase your productivity by… Read more

Get Ready For C# 4.0!

Visual Studio 2010 is here! And of course this means that C# 4.0 is also here. Let’s do a quick review of the new language features added in this release. Dynamic The dynamic keyword is a key feature of this release. It closes the gap between dynamic and statically-typed languages. Now you can create dynamic… Read more

Covariance and Contravariance FAQ

In this post I’ll try to answer the most common questions I find on forums and in documentation feedback about C# covariance and contravariance. It’s a big topic for a single blog post, so expect to see a lot of “more information” links. Special thanks to Eric Lippert and Chris Burrows for reviewing and providing… Read more

What is the difference between “dynamic” and “object” keywords?

Let’s take a quick look at the object keyword first. I’m not going to talk a lot about it because it’s been around since C# 1.0. This keyword is nothing more than a shortcut for System.Object, which is the root type in the C# class hierarchy. (However, as Eric Lippert pointed out in his blog… Read more