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:

Polymorphism in C#

In this post, we are going to learn about the different types of polymorphism in C#, how they work and how we can use them in our code. Let's start. Types of...

How to Check if .NET Is Already Installed

In this article, we will learn how to check if .NET is already installed on both Windows and Linux. Some developers find it difficult to understand which components of .NET need to be installed before the development starts. This is often the case with beginners....

How to Detect if a Dictionary Key Exists in C#

In this article, we are going to explore how to detect if a dictionary key exists in C#, when and why we should do that. Finally, we are going to have a final word on a common mistake when checking keys. A dictionary is a data structure that maps keys to values, where...

Expression-bodied Members in C#

In this article, we are going to learn how expression body definitions and expression-bodied members in C# work. Expression body definitions let us define our methods and properties using a simplified and concise syntax that is extremely readable. We can use...

When to Use Static Classes in C#

C# language supports static classes. In this article, we are going to learn when to use static classes in C# and how to implement them using a .NET (Core) console application. To download the source code for this article, you can visit our GitHub...

Writing to a CSV File in C#

Writing data to a CSV file is a common operation. In this article, we will show how to easily write data to a CSV file in C# using the CSVHelper NuGet package. Even though there are different methods of doing this, using this package is by far the most common and...

As and Is Operators in C#

In this article, we are going to learn about the type-testing "as" and "is" operators in C#. Sometimes, when we code in a strongly typed language like C#, the need arises to mix and match a little bit. That's okay, as we can't always foresee the path that the...

Using Authorization with Swagger in ASP.NET Core

In this article, we are going to look at how to implement swagger authorization in an ASP.Net Core Web API application. We are only going to cover how to set up swagger to accept JSON Web Token (JWT) and how to utilize the token generated to access restricted...

How to Convert Char Array to String in C#

In this article, we’re going to talk about the char type, and explore options to convert char array to string in C#. The char type keyword is an alias for the .NET System.Char structure type that represents a Unicode UTF-16 character. .NET System.Char array stores...

Using Autofac in a .NET (Core) Project

In this article, we're going to learn about using Autofac in .NET projects. Autofac is a powerful third-party Dependency Injection (DI) container. Dependency Injection is one of the most important concepts in modern software development since it helps us build loosely...

How to Get an Item by Index From Dictionary in C#

In this article, we’re going to explore accessing Dictionary items by index in C# and its performance considerations. The Dictionary<TKey,TValue> generic class provides the ability to map keys to values. Retrieving a value by using its key is quite fast, almost...

How to Check if StringBuilder Is Empty

In this article, we’re going to talk about the StringBuilder class, and explore options to check if it is empty, directly or indirectly. So, let's start. What...

Cancellation Tokens with IAsyncEnumerable

This article will remind us what cancellation tokens are and how to use them in C#. After that, we are going to talk about how we can use them with the IAsyncEnumerable interface and the cases when we should be careful while using them. To download...

Onion Architecture in ASP.NET Core

In this article, we are going to learn about Onion architecture and what are its advantages. We will build a RESTful API that follows the Onion architecture, with ASP.NET Core and .NET.  The Onion architecture is also commonly known as the “Clean architecture” or...

Top 11 C# Tips to Improve Code Quality and Performance

In this article, we are going to learn some useful C# tips on how to improve our code quality and performance.  Let’s get started! Why These C# Tips? Before we begin, let us briefly discuss why we chose these specific C# tips over many others that certainly exist....

Hangfire with ASP.NET Core

Almost all applications need to do some sort of background work. Whether it’s a long and tedious task or a repetitive job that we need to do every other day, in this article we are going to learn how we can easily implement it. For this, we are going to be using...