How to Read a String From a .resx (Resource) File in C#
In this article, we are going to learn how to read a string from a .resx file. While doing this, we are also going to understand what is going on under the hood. Additionally, we will follow some of the best practices on how to manage resource files, and lastly, offer...
Dynamically Adding Rows on a Form in Razor Pages
In this article, we will delve into ASP.NET Core forms and how to add rows to them dynamically. We'll use razor pages to create the form and SQLite as our database. [sc name="github"...
How to Solve The type ‘TRequest’ Cannot be Used as Type Parameter in MediatR
When working with MediatR in .NET, we can often utilize its Pipeline Behavior. In this article, we'll examine a common warning related to the type TRequest that can occur while working with it, see why it appears, and how we can solve it. [sc name="github"...
Ignore Null Values With AutoMapper
AutoMapper is a mapping library that helps us to convert one object type to another. While it offers incredible flexibility and convenience, dealing with null values within source objects can sometimes lead to unexpected issues. In this article, we will explore how...
Using Keyed Services to Resolve Dependencies in .NET
In this article, we will look at keyed services - a new feature in .NET 8 that allows us to retrieve services by a given key. [sc name="github"...
Understanding the Unit of Work Pattern in C#
In this article, we will discover the unit of work pattern, its advantages and disadvantages, and an example implementation that is completely ORM agnostic. Moreover, we will look at the unit of work's connection with the repository pattern and we will see how easy it...
How and When to Use TPC Inheritance Mapping in EF Core
In this article, we will discuss the recently added Table Per Concrete Type (TPC) inheritance mapping strategy in EF Core 7. In .NET applications, Entity Framework Core (EF Core) has transformed how we communicate with databases by linking object-oriented domain...
ConcurrentQueue in C#
In this article, we embark on a journey to explore the depths of the ConcurrentQueue class in C#. We'll delve into its fundamental concepts, its usage, and its role in ensuring thread safety while enabling parallelism. By the end, we'll have a comprehensive...
How to Perform Case-Insensitive Substring Search in C#
In this article, we will explore the techniques of performing case-insensitive substring search in C#, with the usage of the String.Contains() method, String.IndexOf() method, Regular Expressions, and LINQ in conjunction with String.Equals(). Additionally, we will...
How to Implement Audit Trail in ASP.NET Core Web API
In this article, we are going to look at different ways of implementing an audit trail in ASP.NET Core. So let's get going. [sc...
Replace Line Breaks in a String in C#
One common task in text processing is to replace line breaks in a string for various reasons. For instance, we might want to create a single, continuous string without any line breaks to save space or remove unwanted formatting. Alternatively, we might need to change...
Global Exception Handling for MediatR Requests
In this article, we are going to dive into global exception handling within an ASP.NET Core Web API controller using the MediatR library. Particularly, we will focus on the MediatR way of handling exceptions. There is also another way of using Middlewares in ASP.NET...
Converting a Hexadecimal String to a Byte Array in C#
In this article, we will examine several techniques for converting a hexadecimal string to a byte array. In our previous article...
Refactoring Dispensables in C#
In this article, we will explore refactoring dispensables in C#. We'll focus on identifying code smells and enhancing our code through practical refactoring techniques. [sc name="github"...
Selecting Xml Nodes With XPath in C#
In software development, we constantly have to handle different data formats. The XML standard is one of the most used document formats in this context. In this article, we will learn how to use XPath to select data from an XML document, in C#. [sc name="github"...
Testing Time-Dependent Code With TimeProvider in .NET
In this article, we'll look at TimeProvider - a new feature coming to C# 12 and .NET 8 that provides a built-in way to deal with and test time-dependent code. [sc name="github"...
22 C# Best Practices
In the ever-evolving world of software development, writing clean and efficient code by using C# best practices is crucial. It not only enhances the maintainability of our codebase but also contributes to the overall success of our projects. In the upcoming sections,...
Database First Development With EF Core Power Tools
In this article, we'll explore EF Core Power Tools, a popular toolbox aimed at simplifying the development workflow when using Entity Framework Core in .NET applications. Its standout feature is the graphical user interface (GUI) it provides for reverse engineering...
Memory Optimization With ArrayPool in C#
In this article, we will learn how to achieve memory optimization in C# through the utilization of the ArrayPool class. We'll explore the significance of memory efficiency and validate its effectiveness via benchmarking, providing a comprehensive guide to enhance...
Using a Discard Variable in C#
In this article, we are going to learn about the differences between a discard variable and the usual variables in C#. We will also see some practical uses of a discard. [sc name="github"...
Create Cryptographic Numbers With RandomNumberGenerator
In this article, we'll explore how to generate random cryptographic numbers with RandomNumberGenerator API in C#, and why it is paramount in the context of cryptography. [sc name="github"...


