fbpx

Latest Posts On Code Maze

Radix Sort in C#

Radix Sort in C#

If you're a programmer, you've probably heard of the radix sort. But what is it, exactly? And how can you use it in your code? In this article, we'll take a closer look at the radix sort in C#, learn how to implement it, and analyze its time and space complexity. [sc...

How to Mock the File System for Unit Testing in .NET

How to Mock the File System for Unit Testing in .NET

In this article, we are going to learn how to mock the file system and unit test a component that interacts with the file system. This last one is a dependency in our application's classes and we can't include it in a unit test. We are going to see that correctly...

Dictionary in C#

Dictionary in C#

In this article, we are going to talk about the Dictionary in C#. We will learn how to create a dictionary, add, retrieve, update, and delete elements. Among that, we will see the usage of its common properties and methods. [sc name="github"...

Vertical Slice Architecture in ASP.NET Core

Vertical Slice Architecture in ASP.NET Core

In this article, we are going to learn about Vertical Slice Architecture in ASP.NET Core and the benefits it provides to make our code more maintainable. We're also going to learn how it differs from traditional architecture and its advantages over the traditional...

Console Class in C#

Console Class in C#

In this article, we are going to talk about the Console class in C# and inspect the different methods and properties this class contains. The Console...

Global Using Directives in C#

Global Using Directives in C#

In this article, we are going to learn about Global Using Directives in C#. When we create a console application using .NET 6, the Program.cs class contains a single line of code (not counting the comment): // See https://aka.ms/new-console-template for more...

Code Maze Weekly #126

Code Maze Weekly #126

Issue #126 of the Code Maze weekly. Check out what's new this week and enjoy the read. .NET and C# Understanding PathBase in ASP.NET Core [andrewlock.net] Do you know what the PathBase property (on HttpRequest) is for and how you can utilize it in your application?...

Stack in C#

Stack in C#

In this article, we are going to study Stack in C#, a collection of objects implementing the last-in-first-out method. Let's start. What is Stack...

Long-Running Tasks in a Microservices Architecture

Long-Running Tasks in a Microservices Architecture

In this article, we are going to demonstrate how the microservices architecture handles a long-running task execution. If you want to recap a similar task execution in a monolithic application, you can refer to this previous article. [sc name="github"...

Bucket Sort in C#

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#

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

Code Maze Weekly #125

Code Maze Weekly #125

Issue #125 of the Code Maze weekly. Check out what's new this week and enjoy the read. .NET and C# Get Tweet Engagements Using .NET and C# [khalidabuhakmeh.com] Communicating with Twitter API using the LinqToTwitter library by Khalid Abuhakmeh. Message Ordering in...

Mock Asynchronous Methods Using Moq in C#

Mock Asynchronous Methods Using Moq in C#

In this article, we are going to learn how to mock asynchronous methods using Moq. Moq is an easy-to-use and most popular framework to mock tests using .NET. [sc name="github"...

Remove Duplicates From a C# Array

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#

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

Code Maze Weekly #124

Code Maze Weekly #124

Issue #124 of the Code Maze weekly. Check out what's new this week and enjoy the read. .NET and C# Copying a collection: ToList vs ToArray [www.meziantou.net] ToList vs ToArray, which one is faster? Find out by reading this piece by Gérald Barré. IEnumerable...