Posts about the C# language itself, including use, abuse and features.

When (not) to use Var

Saturday, July 16 2016 csharp

The var keyword in CSharp can be tremendously useful - but for some, it’s still a source of confusion and something to be avoided at all costs. Here’s my take on when you should use var - and when you should not.

Read more »

Semantic Types Redux

Sunday, June 05 2016 csharp

Many thanks to the observant readers who pointed out that I missed a few things in last week’s post on C# semantic types. To round out our semantic type, we need to add a few additional features.

Read more »

Semantic Types in C#6

Friday, May 27 2016 csharp

Creating custom types to represent specific values in your application is a proven way to prevent defects in your code. New features in C# 6 make it easier to write these types - and in this post, we’ll explore how to write a semantic type that plays well in the C# world.

Read more »

Property Enhancements for C#

Sunday, December 20 2015 csharp

What if a property declaration was a scope, inside which you could declare additional members - more than just the standard get and set declarations?

Read more »

Language Extensions for C#

Monday, May 19 2014 csharp

With the recent release (and open sourcing) of the Roslyn compiler for the .NET framework, I’ve started thinking about how it might be constructively used. The powers at Microsoft have made it clear that they won’t be putting the syntax of C# itself up for grabs - and for good reason.

Read more »