Blog Feed

How-To: Create Blazor Dark-Mode App with Bootstrap 5.3

Many web applications today support dark-mode display because users (and especially developers) enough the benefit of reading content with a dark background. Blazor apps that are built with Bootstrap 5.3 can easily support dark mode in their applications. In this article, we will only focus on defaulting the application to dark-model... a future article will … Continue reading How-To: Create Blazor Dark-Mode App with Bootstrap 5.3

Central Package Management with NuGet

Managing dependencies across multiple projects can get unwieldy, especially as the project count grows. NuGet's Central Package Management (CPM) feature aims to simplify this by letting developers define package versions in a single location. With CPM, you avoid the redundancy of specifying package versions in each project individually. Here, we’ll explore how to set up … Continue reading Central Package Management with NuGet

Secure Minimal APIs with API Key Authentication

If you’re building a .NET 8 application and want robust security, you might assume it requires a lot of complex authentication setup. But here’s the good news: you can implement API key authentication with just a few lines of code. With this straightforward approach, you can secure your services against unauthorized access quickly and easily. … Continue reading Secure Minimal APIs with API Key Authentication

Understanding await vs. ContinueWith in C# Async Programming

When it comes to asynchronous programming in C#, developers have powerful tools to make applications more responsive and efficient. By allowing long-running operations to execute in the background, we can keep the UI thread free for other tasks, resulting in smoother user experiences. Or when running those tasks on ASP.NET, the service can respond to … Continue reading Understanding await vs. ContinueWith in C# Async Programming

GitHub Action to Publish to NuGet.Org

Publishing a NuGet package to nuget.org can be automated using GitHub Actions, which is a powerful tool for continuous integration and continuous deployment (CI/CD). This guide will walk you through the steps required to publish your NuGet package automatically every time you push a code update to a specific branch in your GitHub repository. Prerequisites … Continue reading GitHub Action to Publish to NuGet.Org

How to Make Internal Types Visible to Other Projects Using .csproj File

In many software development scenarios, especially when working with unit tests, you might encounter situations where you need to test internal types and methods within your code. However, internal members are, by default, inaccessible to other projects. The traditional approach to solving this problem in .NET is to make these internal types visible to specific … Continue reading How to Make Internal Types Visible to Other Projects Using .csproj File

Currency Input in Spectre.Console

I was trying this just the other day in Spectre.Console. I wanted an input prompt that would accept currency values. I started down the path of using a decimal representation (TextPrompt<decimal>). While that mostly worked on the input value, it does not support using negative sign, separators, or decimal places. I wanted to be able … Continue reading Currency Input in Spectre.Console

Understanding C# Keywords

In C#, keywords play a crucial role in defining how your code behaves. They help in establishing various programming constructs like classes, methods, variables, and even asynchronous behavior in a structured and precise way. This article will explore some essential C# keywords, providing clarity on their purpose and usage. 1. sealed: Preventing Inheritance The sealed … Continue reading Understanding C# Keywords

Introduction to Immutability with Records in C#

With C# 9.0, Microsoft introduced the record keyword, a powerful new addition that makes it easier to work with immutable data. Records are designed to simplify the creation of classes that are primarily intended to store data, and they offer a more concise and expressive way to model data compared to traditional classes. If you've … Continue reading Introduction to Immutability with Records in C#

Basic C# Immutability with Tuples

In software development, one of the common challenges is returning multiple values from a method. Traditionally, we’ve handled this by using techniques like out parameters, creating custom classes or structs, or working with arrays and lists. However, with the introduction of tuples in C#, particularly since C# 7.0, there's a more elegant and straightforward way … Continue reading Basic C# Immutability with Tuples