Documenting lessons learned in programming.
Quickly Create .gitignore File
Create a pre-populated .gitignore file via the dotnet CLI.
Registering ASP.NET Core Site as Windows Service
This post explains how to register an ASP.NET Core website as a Windows service via NSSM.
Flurl multipart/form-data Unexpected End of Stream
This is a solution to an IOException "Unexpected end of Stream" when using Flurl to post multipart/form-data.
Get LiteDb Collection From CLR Type
This post shows how to resolve a `ILiteCollection
` from LiteDb using a `System.Type` instance.
Fixing SEC_ERROR_INADEQUATE_KEY_USAGE in Firefox
This post explains how to fix the SEC_ERROR_INADEQUATE_KEY_USAGE error that sometimes occurs when you visit a secure url in Firefox.
Swap Two Variables Without Temporary Variable
This example shows how to swap two variables without using a temporary variable.
Change WPF Button Visibility Based On Command.CanExecute
This post shows how to set WPF button's visibility based on whether or not its bound command can execute.
WPF ListBox Selection via CheckBox
Here's an easy way to control your ListBox's selection by using a CheckBox in each item.
Binding To Attached Properties
This quick post shows how to bind to attached properties in xaml and code-behind.
Polymorphic Serialization in System.Text.Json
This post offers a solution for polymorphic json serialization using System.Text.Json.
WPF and MSTest
This post demonstrates a solution for overcoming the exception that is thrown when trying to test a WPF class with MSTest.
Fixing Relative WPF Bindings On Custom Properties
I recently spent a lot of time troubleshooting a problem where my relative WPF bindings were not behaving as expected for custom dependency properties that I had defined. This post explores the problem and the solution.
Fire And Forget Tasks
This post demonstrates a couple of different ways to execute fire and forget tasks in C#.
WPF Version Numbers
This post examines a couple of different ways that WPF version numbers can be stored and retrieved.
Changing Entity Framework Core Migrations Folder
Want your Entity Framework Core migrations to land in a folder other than the default Migrations folder? Here's how to fix that.
Notify Collection Changed Event Args Reference
If you're like me and find yourself forgetting how the event args work in INotifyCollectionChanged, then here's a quick reference that might be useful.
A dive into enumeration types, commonly known as enums.
Abstract Classes and Interfaces
Abstract classes and interfaces can be used for similar purposes but it's important to understand the differences between the two.
Avoid "You" In Code Reviews
One technique I like to employ when reviewing code is to avoid the word "you" and its derivatives.
Cancellation Types in C#
If you want to support cancellation in C#, you'll want to get familiar with the CancellationTokenSource and CancellationToken types.
Best Practices for Structs in C#
Structs in C# are value types and thus are meant for holding data structures that are usually immutable. If you're going to write a struct, consider the following practices.