Brian Drennan's Blog

Exploring curiosities in software.

Tag "C#"

2 posts

CommandLineParser - .NET Arg Parsing Made Easy!

I’m a huge fan of command-line utilities (aka, console apps). In general, I find console apps to have much lower barriers to use than traditional window-based systems: in many respects, they’re much easier to build than other alternatives (such as Windows Forms and Windows Presentation Foundation apps), with generally lower barriers to entry. That said, I hate writing argument parsers. It’s not that it’s super-difficult, but it’s tedious, and for such a common task, I’d really like to use a library. I’m aware of a few, and found what is easily my favorite recently, CommandLineParser. In this post, I’ll explore what my preferences are, and why I’ve recently selected this one as the default when starting new .NET projects. I’ll also explore how I go about selecting new dependencies for projects that I’m working on.

.net dotnet C# command line args

Benchmarking .NET Code

Have you ever been nervous about making a change to an application, or interested in benchmarking your code in order to demonstrate the efficacy of a proposed change? I recently wanted to change the behavior of a core piece of application code, but wanted to be sure that it was going to be an improvement to the system, beyond simplifying the mental model for the code. To justify my changes, I spent time measuring them, using a tool called BenchmarkDotNet.

benchmarking .net dotnet C#