Posts tagged #csharp

← Back to Archive

Matching Digits in .NET Regex

The regular expression pattern \d matches more than just the ten digits commonly used in programming. Here's a list of matches you might not have expected.

Parsing Markdown in .NET

CommonMark.NET is a Markdown parser for .NET that efficiently transforms Markdown written in CommonMark dialect into HTML.

Design Your Code for Composition

By designing your code for functional composition, you can keep it simple and targeted, making it easier to implement, understand, and test it. More sophisticated logic can be modeled by composing various building blocks of basic functionality — extension methods for collections, in the case of this post.

Stop Cheating the Type System

In C#, every variable of a reference type can hold a null value. Some types like collections and delegates, however, allow for much better default values. Reduce your bug surface area by following reasonable conventions when dealing with null.

Fun with Custom C# Collection Initializers

The collection initializer syntax of C# is a clean way to initialize a collection with values. The compiler will insert appropriate method calls which actually add those items. We can leverage the convention-based nature of this process to provide our custom collection initializers.

← Back to Archive