Code Maze Author

Code Maze

This is the standard author on the site. Most articles are published by individual authors, with their profiles, but when several authors have contributed, we publish collectively as a part of this profile.
Also find me here:



MY ARTICLES:

Boosting Performance With Sealed Classes in .NET

In this article, we are going to learn how we can boost performance with sealed classes in our .NET projects. By default, all classes in C# are open for inheritance. We can use the sealed keyword to prevent inheriting from the class and improve performance for certain...

Path Class in C#

When we want to perform operations on path strings containing file or directory path information, the best choice is to call the built-in C# Path Class methods. This class comes under the System.IO namespace and System.Runtime.dll assembly. In this article, we are...

Counting Occurrences of a Char Within a String in C#

In this article, we are going to learn how to count occurrences of a char within a string in C#. A string is a sequence of characters and we essentially iterate over it to count the number of occurrences of any character within it. [sc name="github"...

Using Query String Parameters with Minimal APIs

In this article, we are going to explain how we can work with query string parameters in Minimal APIs in .NET 6. You may refer here for a nice introduction to the concept of Minimal APIs. Also, we will show new improvements that .NET 7 brings to the table. [sc...

AutoMapper vs Mapster in .NET

In this article, we are going to compare the popular object mapping libraries AutoMapper and Mapster. Later, we'll do a performance benchmark to find the most performant one. [sc name="github"...

What is NullReferenceException in C#?

In C#, a NullReferenceException occurs when we try to access a variable whose value has not been set or has been set to null. It can be easy to trigger this exception accidentally, so it's important to be aware of how to avoid it in the first place. In this article,...

FileSystemWatcher in C#

.NET provides a handy way to deal with monitoring different file system changes. In this article, we will discuss what FileSystemWatcher is, how to set it up, and how to configure it to observe various file system changes. In addition, we will take a look at the...

Indexers in C#

In this article, we are going to learn about Indexers in C#, how to declare them in a class, struct, or interface, and overload them. We're also going to learn what the differences between indexers and properties are. [sc name="github"...

Return File in ASP.NET Core Web API

In this article, we are going to learn how to return a file in an ASP.NET Core Web API and some concepts behind it. That said, we are going to implement a simple Web API to read a local file and return this file to download. [sc name="patreon-source-code"...

Feature Flags in ASP.NET Core

Being able to conditionally enable or disable features in our applications without redeploying our code is a powerful tool that we can take advantage of to quickly iterate on new features in our applications. In this article, we are going to learn about Feature Flags...

Using Generics in C#

Generic programming is a powerful tool that C# offers to developers. In this article, we'll take a look at how generics work in C# and some of the benefits they provide. We'll also see how to use generics with classes, methods, and delegates. Finally, we'll look at...

How to Create a Class Dynamically in C#?

In this article, we are going to learn how to create a class dynamically in C#. Thanks to the introduction of the dynamic type in C# 4, working with dynamic classes has become easier, but we shouldn't abuse it. Dynamic classes are very powerful, but they bring a...

Two-Factor Authentication With SMS in ASP.NET Core

In this article, we will learn how to set up two-factor authentication using SMS in ASP.NET Core. We have previously covered Two-Step Verification with ASP.NET Core Identity using Email. This article is a continuation that uses generated code provided by ASP.NET Core...

How to Execute Multiple Tasks Asynchronously in C#

In this article, we are going to learn how to execute multiple tasks in C# in sequence and parallel. By using async/await, we avoid performance bottlenecks and enhance the scalability of our application. Depending on the business logic, we may need to execute...

Dependency Injection With Simple Injector in .NET

Simple Injector is a .NET library that enables developers to apply dependency injection into their code. Moreover, Simple Injector supports different platforms including .NET 4.5 and up, .NET Standard, UWP, Mono, .NET Core, and Xamarin. [sc name="github"...

Heap Sort in C#

In this article, we'll look at the heap sort algorithm in C#. We'll discuss what the algorithm is, how it works, and see some code examples that demonstrate how to implement it. Finally, we'll discuss its time and space complexity and compare the algorithm to other...

Flags Attribute For Enum in C#

In this article, we are going to learn about the Flags attribute for enum in C#, what its benefits are, and how to use it in a practical example. [sc name="github"...