Ask a FAQ Question

Do you have a FAQ about: The C# Language or compiler The C# IDE The Visual Studio debugger Reply to this post, and your question will be added to our list to be answered. Of course, depending on the nature of your comment, and the volume we receive, we may not get to every question…. 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

New Features in C# 6

C# 6 is the version of C# that ships with VS 2015 Preview. The philosophy behind this version is straightforward: improve simple everyday coding scenarios, without adding much conceptual baggage. The features should make code lighter without making the language heavier. Some features are mostly syntactic sugar (expression-bodied members, string interpolation, nameof), some complete what… 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

Dynamic in C# 4.0: Introducing the ExpandoObject

You have probably already heard about the new dynamic feature in C# 4.0 and how it is used to support COM interop. If you haven’t, I strongly recommend reading the following MSDN articles: Using Type dynamic and How to: Access Office Interop Objects by Using Visual C# 2010 Features. Well, where else can you use… 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

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

Why did I receive the error: “The type or namespace ‘<namespace name>’ does not exist in the class or namespace ‘<parent namespace>’ (are you missing an assembly reference?)”

You need to add a reference in your project to an assembly where that namespace is defined. If you are using VS.NET: 1.  Right click on the References folder on your project.2.  Select Add Reference.3.  Select the .NET tab (or select the Browse button if it is not a .NET Framework assembly).4.  Double-click the assembly… Read more

Why doesn’t C# have VB.NET’s ‘with’ operator?

Many people, including the C# language designers, believe that ‘with’ often harms readability, and is more of a curse than a blessing. It is clearer to declare a local variable with a meaningful name, and use that variable to perform multiple operations on a single object, than it is to have a block with a… Read more

Throwing the Big Switch on Roslyn (Matt Gertz, VS Managed Languages Development Manager)

So, the entryway to my house has eight light switches along the wall.  Two of them control the porch lights, and another two work the same entryway light (despite the switches being only a couple of feet apart).  I haven’t the foggiest idea what the rest of the switches do.  I’ve been scared to try… Read more