~/devreads

#c# 6

4 posts

30 Jan 2015

jonskeet 3 min read

The problem Invoking event handlers in C# has always been a bit of a pain, because an event with no subscribers is usually represented as a null reference. This leads to code like this: It’s important to use the handler local variable, as if instead you access the field twice, it’s possible that the last … Continue reading Clean event…

c# 6

8 Dec 2014

jonskeet 9 min read

Now that the Visual Studio 2015 Preview is available and the C# 6 feature set is a bit more stable, I figured it was time to start updating the Noda Time 2.0 source code to C# 6. The target framework is still .NET 3.5 (although that might change; I gather very few developers are actually … Continue reading C# 6…

c# 6noda time

8 Apr 2014

jonskeet 3 min read

This post is the answer to yesterday’s brainteaser. As a reminder, I was asking what purpose this code might have: public static class Extensions { public static void Add<T>(this ICollection<T> source, T item) { source.Add(item); } } There are plenty of answers, varying from completely incorrect (sorry!) to pretty much spot on. As many people … Continue reading Extension methods,…

c#c# 6evil code

4 Apr 2014

jonskeet 8 min read

It’s been a scandalously long time since I’ve blogged about C#, and now that the first C# 6 preview bits are available, that feels like exactly the right thing to set the keys clacking again. Don’t expect anything massively insightful from me just yet; I’d heard Mads and Dustin (individually) talk about some new features … Continue reading C# 6:…

c# 6