Multipart Form-Data in HttpClient with ASP.NET Core
In this article, we will learn what multipart requests are and how we can use them. Also, we will review examples of how to send data to remote servers using multipart form-data with HttpClient in ASP.NET Core. [sc name="github"...
How to Get Formatted JSON in .Net Using C#
This article will examine how we can get a formatted JSON representation of our C# objects using two popular libraries - Json.NET and System.Text.Json. [sc name="github" url="https://github.com/CodeMazeBlog/CodeMazeGuides/tree/main/json-csharp/HowToGetFormattedJson"...
How to Mock EF Core DbContext
While unit-testing EF Core applications, sometimes, we may want to mock EF Core DbContext. In this article, we'll talk about a few ways of doing that. ...
How to Convert JSON to DataTable in C#
In this article, we are going to discuss various methods that we can use to convert JSON to DataTable in C#. A DataTable is a representation of a database table that we can use to store data as a collection of rows and columns in a grid format. All the methods that we...
.NET Dependency Injection With Constructor Parameters
Introduction In this article, we'll look at ways to use dependency injection with constructor parameters in .NET Core. Dependency injection (DI) with constructor parameters is a way for us to pass the things our class needs (depends on) when we create a new instance...
How to Return a Default Value From a Dictionary in C#
In this article, we are going to present you solutions on how to return a default value from a Dictionary in C# and run an evaluation test against these methods to find the most efficient. [sc name="github"...
Asynchronous Programming Patterns in .NET
In this article, we are going to learn about the various patterns to implement asynchronous programming in .NET. .NET has had in-built support for asynchronous programming since the release of .NET Framework 1.1. It has been through various improvements over the...
How to Clone a List in C#?
In this article, we will look at all the different ways we can clone a List in C# to another and what we should pay attention to when doing so. In...
How to Insert a Key Value Pair Into an Existing JSON in C#
In this article, we are going to learn how to insert a key-value pair into an existing JSON object. Let’s start. Use Json.NET to...
Refactoring Bloated Code in C#
In this article, we will learn what anti-patterns belong to the group of code smells called bloaters and different techniques for refactoring bloated code in C#. [sc name="github"...
Introduction to Behavior Driven Development (BDD) in C#
Behavior Driven Development, or short, BDD is a software development methodology that relies on examples to define the behavior of a system. In this article, we're going to learn the bases of BDD, see what tools are available, and see BDD in action through simple...
Two Factor Authentication with Web API and Angular using Google Authenticator
In this article, we will enable Two-Factor Authentication with Web API and Angular using Google Authenticator. We can use the Google Authenticator app to get a One-Time Password (OTP) value to enter during login. The initial steps of this article have been taken from...
How to Execute CLI Applications From C#
In this article, we will learn how to execute CLI applications in C# using a built-in class called Process and using open-source libraries. We will cover how we can execute CLI, how we can check if the CLI execution was successful, and how we can react to the...
Method Overriding in C#
Method overriding in C# is a form of implementing polymorphism. We also call it "run-time" polymorphism. In this article, we are going to learn more about method overriding, how to implement it, and how it differs from method overloading. [sc name="github"...
How to Implement Checkbox List in ASP.NET Core
A Checkbox List is an important feature to encourage multiple selections of inputs in forms. We will start with a brief overview of the existing checkbox functionality in ASP.NET Core and later on move to the implementation of a checkbox list. [sc name="github"...
Tracking Application Health With OpenTelemetry Metrics in .NET
The ability to gather metrics for our .NET applications is very important, as it allows us to gain insight into the health and performance, as well as any issues our applications may be experiencing. Metrics are one of the 3 fundamental pillars of OpenTelemetry, and...
How to Get Value by Key from JObject in C#
In this article, we are going to learn different ways to get value by key from JObject in C#. Let's start. [sc name="videolink" videotitle="4...
How to Use SQL LIKE Operator With LINQ in C#
In this article, we will learn how to use the SQL LIKE operator with LINQ in C#. Let's start. Sample Application We will start with a .NET 7 console...
How to Get an Enum Member as a String in C#
In this article, we're going to learn how to get a string representation of an enum member in C#. The possibility of defining enumeration types in C# - most widely known by the keyword enum - is a very useful feature. We can use them to assign named constants that...
Check If a String Array Contains a Value and Get Index
In this article, we are going to see the different ways we can check for a specific value in a string array and return the index of that value. We will focus mainly on linear search methods. We cannot use binary search methods since we do not know if the array is...
ConcurrentDictionary in C# – Detailed Guide
We've already written about a regular Dictionary in C#. We've also explored the basics of ConcurrentDictionary as one of many Concurrent Collections in C#. In this article, we will go into more detail and explore the use cases in which ConcurrentDictionary can be...



