csharp

Making ASP.NET Core applications readable - the options patterns

September 03, 2024  6 minute read  

Applications are read more often than they are written. The normal situation when a developer comes onto a project is that anything from a couple of weeks to several months is requried to come “up to speed” on the code base. Making the efforts required for readability of the code is important, and I spend a ton of time up front to ensure my applications are understandable without needing an in-depth lesson from me on how it works. Let’s take an application I am starting (today actually). I...

Centrally managing dependencies in your C# solutions

August 15, 2024  3 minute read  

Today, I’d like to talk about the best way to centrally manage dependencies in your dotNET solutions. It’s common for a single solution to comprise multiple projects. The happy path for maintaining dependencies in Visual Studio involves right-clicking on the project and selecting “Manage NuGet packages…”. Once you have a set of packages, you can keep them in sync by right-clicking on the solution and doing the same thing. By using “Manage NuGet packages” for the solution, you can update m...

Better data validation exceptions with C#

August 10, 2024  6 minute read  

There are times when I look at code I have written and think to myself “there has to be a better way.” When I start thinking like this, I start by looking at the documentation - the .NET official documentation is incredibly well written and simple to digest, and the fundamentals section is something I believe every language documentation should aspire to. Take exceptions, for example. When I started my career in software development, methods were written with a block of validations at the ...