The journal

Notes from the workbench.

149 articles on building software and understanding how it works.

ASP.NET Core MVC

The opening recipe in my ASP.NET Core series: setting up a clean MVC project as the foundation the rest of the recipes build on.

Extension support for .Net Core application

Plugins for a .NET Core app boil down to loading .dlls at runtime, finding the interesting interfaces and registering them in IoC. Since IoC already gives you loose coupling, dynamic loading is a small step — shown here.

.Net Core Console Application IoC

MVC gets IoC boilerplate generated for free; console apps don't. With HostBuilder from the Generic Host it's easy to wire up the same dependency injection, config and logging in a console application — here is the boilerplate.

Setting up new .Net projects

After ~30 years and a few thousand projects, this is how I set up new .NET solutions: naming, project structure, .NET Standard vs Core choices — and the reasoning behind each habit. Not a book on architecture, just a clean, consistent setup.

sizeof() vs Marshal.SizeOf()

sizeof() compiles to a constant; Marshal.SizeOf() measures the marshaled struct at runtime. What each one really returns, what it costs, and when to use which — with IL to prove it.

Cost of method wrapper

What does a method that just calls another method actually cost? Using the == operator vs IEquatable.Equals as the guinea pig, I benchmark wrapper calls across compilers, JITs and runtimes — and read the disassembly to see why.