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:

Bucket Sort in C#

Sorting is one of the most common programming problems that we have to solve. The good news is, that there are many sorting algorithms available to address such problems. However, each algorithm has its strengths and weaknesses, which may influence the choice of...

Anonymous Types in C#

In this article, we're going to learn about anonymous types in C#. After learning what they are, we're going to learn how to use them in various scenarios through examples. [sc name="github"...

Remove Duplicates From a C# Array

In this article, we are going to share the different methods on how to remove duplicates from an array in C#. In addition, we are going to compare these methods to check their performance. Arrays contain multiple values of the same type. It’s a common occurrence to...

How to Mock HttpClient with Unit Tests in C#

Mocking HTTP requests for unit testing is important because of the prevalence of APIs in modern software development. In this article, we will show you how to mock HttpClient and compare two ways to mock HTTP requests in our unit tests. We will use Moq to mock a...

Using the when Keyword in C# While Handling Exceptions

In this article, we are going to learn why and how to use the when keyword within try-catch blocks while handling exceptions in C#. We cannot avoid the occurrence of exceptions in the life cycle of an application. An exception is a problem that appears unexpectedly...

How to Read Data From a CSV File in C#

Reading from a CSV file in C# is a common operation. In this article, we are going to show how to easily read data from a CSV file in C# using the CSVHelper NuGet package. [sc name="patreon-source-code"...

Check if a Number is a Power of 2 in C#

In this article, we are going to learn the most efficient and popular solutions to a very common problem - checking if a number is a power of 2. While it seems an easy task, we will see that some of these solutions are faulty in presence of corner cases. [sc...

Copy the Entire Contents of a Directory in C#

In .NET, there is no built-in way to copy the entire contents of a directory including subfolders and their content. In this article, we will explore a clean, platform-agnostic solution for this operation. Additionally, we will see how we can implement this in the...

How to Return HTML From ASP.NET Core Web API

A typical web API returns JSON or XML responses. However, rare cases exist where we need to return responses in other formats. In this article, we are going to learn how to return HTML from ASP.NET Core Web API. We will also state some use cases for this type of API....

Sorting and Filtering With LINQ

In this article, we are going to learn about Sorting and Filtering with LINQ. Language-Integrated Query, or LINQ for short, provides a robust set of language extensions that we can use to shape query results according to our current needs. LINQ not only allows for a...

Google Charts With Angular and ASP.NET Core Web API

In this article, we are going to look at using charts with Angular and ASP.NET Core Web API to visualize the relationship between data. We'll use Google Charts to create the visualization. It is a Javascript-based library used for data charting and visualization. We...

Priority Queue in C#

Priority Queue in C# is a very useful data structure that has so many real-world applications. In this article, we are going to cover the main concepts of Priority Queue in C#. We have covered the basic Queue in C#, it is recommended to check it out before continuing...