How to Print a 2D Array to the Console in C#
In this article, we will learn how to print a 2D array to the console using C#. Whether we are handling complex data structures or simply organizing information efficiently, understanding how to manipulate 2D arrays is a valuable skill. [sc name="github"...
Getting Started With EasyCaching in ASP.NET Core
EasyCaching is an open-source caching library that helps us manage caching more easily, and flexibly and it's an alternative to ASP.NET Core's out-of-the-box caching library. Caching is a prevalent and useful technique for improving the performance of web...
How to Set the Exit Code for a Console Application in .NET
In this article, we will learn how to set the exit code for a console application in .NET. Let's dive in. What Are Exit Codes Exit codes are...
Lookup in C#
When we build our .NET applications, we commonly use dictionaries to store data as key-value pairs. However, dictionaries do not allow us to map multiple values to a single key. In this article, let's explore the Lookup class in C# and discuss how we can use it to...
Modular Monolith Architecture In .NET
In this article, we will discuss the concept of Modular Monolith Applications, and how they compare with traditional Monoliths and Microservices. We will also explain the different communication patterns we can implement between our modules. [sc name="github"...
Fastest Ways to Perform Base 10 Conversions in C#
Performing base 10 conversions is fundamental when learning basic computer science and mathematical concepts. Since we know computer systems understand binary, such conversions can help us form different number representations that we can use for various applications...
How to Compare Two Dictionaries in C#
In this article, we will first explore several ways to compare two dictionaries in C#. Then, we will compare and rank the performance of these approaches using the BenchmarkDotNet library. When we work with Dictionary objects in C#, checking their equality is a common...
Using Delegating Handlers to Extend HttpClient in ASP.NET Core
In this article, we'll explore HttpClient's delegating handlers in ASP.NET Core. These handlers act as a middleware...
Introduction to the StronglyTypedId Package in .NET
In this article, we'll look at the StronglyTypedId NuGet package and how it helps us enhance type safety and code readability in our .NET projects by generating strongly-typed IDs for our entities. [sc name="github"...
How Does the Default ASP.NET Core Identity Password Hasher Work?
In this article, we will delve into the default ASP.NET Core Identity Password Hasher. We will focus on understanding how it transforms plain text passwords into secure hashes and highlighting its security features. [sc name="github"...
How to Compare Two Files in C#
In this article, we will learn how to compare two files in C#. There are several reasons why we might want to compare two files in our code, such as integrity checks, detecting duplicate files, version control, synchronization, and more. But what are the different...
How to Set Global Default JSON Serialization Options in .NET
JSON serialization is the process of transforming .NET objects into JSON format, which ensures data exchange within applications. Implementing global default JSON serialization settings in ASP.NET Core Web API maintains uniformity across applications. In this article,...
Real-Time .NET Error Reporting With Exceptionless
In this article, we are going to cover the Exceptionless library and see how to use it in an ASP.NET Core application. So let's get started. What Is...
How to Filter a List Based on Another List In C#
Lists in C# are one of the most ubiquitous data structures. We perform all kinds of operations on them, such as appending, inserting, removing, sorting, and filtering. In this article, we'll focus on the latter - filtering. In particular, we'll see how to use a list...
View-Based Authorization in ASP.NET Core
View-based authorization is an authorization strategy that enables us to manage UI elements' visibility based on the user's identity. In this article, we'll take a look at how we can achieve view-based authorization in an ASP.NET core application. [sc name="github"...
Add a Cookie to an HttpClient Request/Response in ASP.NET Core
What are cookies? Websites send small pieces of text, known as internet cookies, to our browsers whenever we visit them. They help us have a personalized experience on that particular website and remember it for the next time we visit it. Our goal today is how to make...
Using Source Generators to Validate IOptions in ASP.NET Core
In this article, we'll look at how to use source generators to validate IOptions and ensure they meet the required configuration expectations. [sc name="github"...
How to Generate a Random Color Name in C#
In this article, we will learn how to generate a random color name using the KnownColor enumeration. This enum is particularly useful in UI design and data visualization, as it provides a wide variety of preset colors. [sc name="github"...
Change Default and per Request Timeout in HttpClient
In this article, we'll demonstrate how to set a default request timeout for all requests and configure specific request timeout settings for individual requests using HttpClient. [sc name="github"...
Using the Result Pattern in .NET Web API
In the expanding world of APIs, meaningful error responses can be just as crucial as well-structured success responses, and here, the Result Pattern can help us greatly. [sc name="patreon-source-code"...
How to Call an Action From Another Controller in ASP.NET Core
In this article, we will learn how to call an action from another controller in .NET MVC. We sometimes need to call an action...