Dev Corner

Diving deep into the code to solve your challenges and offer up expert tips
  • Category

  • Author

Real world use cases for default interface methods

You already know that interfaces are meant to be immutable and should not be upgraded once released. Before C# 8.0, the best way to extend an interface was to create extension classes for adding default behaviors. But with default interface methods, you can skip the...

3 tips for tuning your skills with C# strings

You may be guilty of taking strings for granted. They’re baked into the framework as a built-in type, and since almost every codebase uses them they tend to just fade into the background. Throughout the years, though, I’ve seen people new to C# use strings in several...

Meaningful test coverage in .NET Core 3

Your tests come with a glowing code coverage report, but I’m not convinced. A subtle rot spreads through your tests without you even knowing it: your tests keep passing, your code coverage report keeps claiming health, but in fact, your tests drift further and further...

Refactoring gets interesting with generics

Duplication in code often arises organically, and can cause problems like missing updates of the duplicated cases, or just obscuring the actual flow through the code due to large amounts of boilerplate code. Refactoring that code to eliminate duplication can take a...

The fundamentals of Xamarin development

You’ve spent months or years building a robust web application with dozens of features and an established user base. One day, the boss visits and gives you a simple, yet terrifying requirement: “We need a Xamarin app.” If you’ve only worked...

How to leverage a lightweight OpResult class

There are times in code when you need to return the results of an operation, but aren’t using a transport mechanism like HTTP that gives you a data structure with built-in statuses. In these situations, a lightweight OpResult class can be really helpful. The original...

Patterns for using Entity Framework in C# 8

C# 8 adds Nullable Reference Types, which warns us about problematic null values. If you’re upgrading to C# 8, you may run into a few challenges for Entity Framework. Although frustrating at first, the warnings can also be catalysts for finding more effective ways to...