How to Select Multiple Records Based on a List of IDs Using LINQ
In this article, we are going to explore how to select multiple records based on a list of IDs using LINQ. We will demonstrate two ways to do that, and we will investigate the cases in which each might be a better choice. Did you know that starting with .NET 7 you can...
Fastest Way to Convert a JObject to a Dictionary in C#
In this article, we'll explore different ways to convert a JObject to a dictionary in C#. In C# programming, a JObject is a fundamental component...
How to Get a Value of a Property By Using its Name in C#
In programming, there are scenarios where dynamically retrieving the value of a property by its name becomes necessary. This guide delves into the intricacies of how to get the value of a property by using its name in C# using reflection. Assuming we have a...
How to Check if Items of a List Exist in Another List in C#
One of the programming scenarios we can encounter once in a while is checking whether certain items in a list exist in another. This article is going to dive deep into all the techniques to compare lists. We are also going to compare how these techniques perform and...
How to Maximize the Browser Window With Selenium in C#
In this article, we will talk about how to maximize the browser window with Selenium in C#. We will use an xUnit test application with Selenium to show the maximized browser window. [sc name="github"...
Using MariaDB With ASP.NET Core Web API
In this article, we will discuss how to use a MariaDB database with an ASP.NET Core Web API. First, we will discuss what MariaDB is and how we include it in our application. Then, we will use the Entity Framework Core library to create a mapping between our Web API...
How to Calculate the Number of Days Between Two Dates in C#
In this article, we will learn how to calculate the number of days between two dates, a task commonly encountered in various applications. We will achieve this by utilizing the DateTime struct, TimeSpan struct, and DateTimeOffset. [sc name="github"...
How to Truncate a String in .NET
In the world of software development, we sometimes face requirements to shorten strings within our applications. A common use case is displaying text in user interfaces, such as labels, buttons, or columns in a table. To ensure that the text fits within a limited...
How To Remove HTML Tags From a String in C#
HTML, since its inception, has played a pivotal role in web development, serving as the foundational markup language for creating and structuring web pages. As developers, we engage with web-related data in our programming endeavors, it is a frequent scenario to...
Add Custom Claims to Access Token in Duende
In this article, we will show how to add custom claims to access tokens in the Duende Identity Server. Custom claims allow us to include application-specific information in ID and access tokens. This information encompasses details not covered by the standard claims...
How to Escape Curly Brackets and Special Characters in C#
Creating well-formatted strings is crucial in coding. However, including special characters, like curly brackets, poses challenges for developers, potentially compromising code integrity. In this article, we explore how to escape special characters in C# when...
How to Compare Two Lists Through One Property in C#
In this article, we walk through a practical guide on how to compare two lists in C# through one property. We explore several methods and conclude with an evaluation benchmark to find the one that best suits our needs. [sc name="github"...
How to Revert a Migration in EF Core
In this article, we will show how to revert a migration in EF Core. Entity Framework Core is an excellent tool for managing data structure by using familiar object types. If you need a refresher on the basics of EF Core, be sure to check out our full Entity Framework...
Plugin Architecture Pattern in C#
In this article, we explore the concept and implementation of a plugin architecture in C# and .NET 8. We also learn about the motivations to use this architecture, as well as the advantages and disadvantages of doing so. [sc name="github"...