Latest Posts On Code Maze

How to Perform Case-Insensitive Substring Search in C#

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...

Global Exception Handling for MediatR Requests

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...

Refactoring Dispensables in C#

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. Modifying response headers in ASP.NET Core is pretty...

22 C# Best Practices

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

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#

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#

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.  Let's learn what discriminated unions are and why this feature has been...

Using ML.NET CLI To Automate Model Training

Using ML.NET CLI To Automate Model Training

As we continue our article series about ML.NET, we will look at the ML.NET Command Line Interface (CLI) tool.  Like ML.NET Model Builder, the ML.NET CLI uses AutoML to produce machine learning models.  [sc name="github"...

When to Use ReaderWriterLockSlim Over lock in C#

When to Use ReaderWriterLockSlim Over lock in C#

In this article, we will explore the lock statement and the ReaderWriterLockSlim class. We will discuss the situations in which it's better to use ReaderWriterLockSlim over lock in C#. We will also compare the ReaderWriterLockSlim class with the ReaderWriterLock class...

Different Log Levels in Serilog

Different Log Levels in Serilog

In this article, we will discuss the different log levels in Serilog and how to configure them. We will explain the log targets offered by Serilog for writing logs. Additionally, we will cover how to configure Serilog to differentiate these options according to log...

DateTimeOffset vs DateTime in C#

DateTimeOffset vs DateTime in C#

C# offers many ways to handle date and time values. Due to the increase in the number of globalized applications all over the internet, it is paramount that dates and times of events are accurate and handled effectively. In this article, we will look at the...