Default Interface Members, What Are They Good For?
In my last post I promised to look at some of the use cases where I think it's worthwhile to consider using default interface members. They're certainly not going to replace many existing conventions, but I have found some situations where targetted use can lead to cleaner, more maintainable code (at least in my own opinion).
Default Interface Members and Inheritance
Default interface members (or "DIM" as I've seen the feature called) is a new language feature available in C# 8 that lets you define implementations directly in an interface. I started out with the intent of writing about use cases for the feature, but ended up writing so much that I decided to split the post in two. This part deals with how default interface members need to be invoked and the differences in semantics between class inheritance and default interface member implementation.
Quick and Dirty Multiple Value Dictionary Using Extension Methods
Though it's not a collection I tend to reach for often, there have been times when I really need a multiple value dictionary (that is, a dictionary that contains more than one value per key). In the past, I've usually reached for the excellent PowerCollections library to fill the gap. However, that requires bringing in another library and it can be a little heavy-weight for just this one collection class. There are also a ton of other implementations out there. But perhaps there's a better way to fill this need, one that doesn't require a lot of extra code. These two extension methods do most of the work of a multiple value dictionary, but don't require any extra classes or libraries: