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...
Code Maze Weekly #159
Issue #159 of the Code Maze weekly. Check out what's new this week and enjoy the read. .NET and C# Top Picks Creating and downloading zip files with ASP.NET Core [blog.elmah.io] While there are some nice NuGet packages to help us with...
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. What Is JObject? JObject is a class...
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...
Code Maze Weekly #158
Issue #158 of the Code Maze weekly. Check out what's new this week and enjoy the read. .NET and C# Top Picks Using .NET code from JavaScript using WebAssembly [www.meziantou.net] Starting with .NET 7 we can run any .NET method from...
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...
Tracing .NET Applications Easily With OpenTelemetry
One of the fundamental concepts in the OpenTelemetry project is the ability to observe end-to-end requests through our applications, which is known as tracing. We achieve this by adding custom code to our .NET applications to emit this tracing information, which we...
Realistic Data Generation in .NET With Bogus
In this article, we are going to learn what Bogus library is and how we can use it to generate fake data in .NET. We will create examples for generating data in different ways and show some additional community extensions we can use on top of Bogus. [sc name="github"...
Required Members in C#
C# 11 introduces the concept of required members. Any code instantiating the containing class must initialize these members; otherwise, the compiler will issue an error while compiling it. In this article, let's learn how to use this feature to prevent bugs and catch...
How to Randomize a List in C#
C# has several built-in methods for working with arrays and lists, but what if you need to randomize a list of items? In this article, we'll look at some techniques we can use to randomize lists in C#. We'll also discuss some of the pros and cons of each technique and...