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...
How to Find the Latitude and Longitude of a Location in C#
In this article, we will learn how to find the latitude and longitude of a location in C# using the Google Maps Geocoding API. We'll introduce two different methods for obtaining the coordinates: using the GoogleMaps.LocationServices NuGet package, which simplifies...
Generate QR Codes With QRCoder in .NET
In this article, we will discuss how to generate QR codes, specifically with the .NET library QRCoder. We will generate basic QR codes that contain simple strings, discuss reading from and writing QR codes to a database, and try out real-life use cases, such as...
Count the Number of Vowels in a String in C#
In this article, we will take a closer look at the techniques we can use to count the number of vowels in a string in C#. We will go through the code and learn more about each approach. [sc name="github"...
How to Update an Item in a List in C#
In this article, we'll look at how to update an item in a List in C#, using a simple library management system as an example. We'll explore the intricacies of this common operation and learn how to manipulate lists in our C# applications effectively. [sc name="github"...
Differences Between .NET and C#
When diving into the programming world, distinguishing between .NET and C# can be puzzling. .NET is a framework, that provides a platform for building applications. In contrast, C# is a programming language used within this framework. Despite their close association,...
Serialization and Deserialization with YamlDotNet
YAML (YAML Ain't Markup Language) is a human-readable data serialization language, while YamlDotNet is a .NET library that helps us serialize and deserialize YAML data. Due to its simple and intuitive syntax, programming languages frequently use YAML for configuration...
Fastest Way to Get a Dictionary Key by Value in C#
The C# language does not provide a built-in method that we can use to retrieve a key from our dictionary using its value. However, using other features of the language, we can create methods to perform this task. In this article, let's implement and discuss several...
How to Show Query Parameters in Swagger in ASP.NET Core
In the .NET ecosystem, Swagger is a common way to define and document our APIs. In this article, we will look at how to show query parameters in Swagger. [sc name="github"...