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...
MY ARTICLES:
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...
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...
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"...
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...
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# 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"...
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"...
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...
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...
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...
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...
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...
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...
In this article, we are going to learn how to get the list of properties in C#, and also how to use the BindingFlags to filter the properties to retrieve. [sc name="github"...
When compiling a C# application, we may see the warning "Non-nullable property must contain a non-null value when exiting constructor. Consider declaring it as nullable." This article explains why we encounter this warning and what we can do to resolve it. [sc...
In this article, we’re going to look at how to convert a string and int to an enum in C#. Enums allow us to declare a group of related constant values in a readable way where the underlying data type is usually an integer. [sc name="github"...
In this article, we are going to talk about boxing and unboxing in C#. When we work with C# language constantly, we need to...
In this article, we will learn how encrypting and decrypting a string is done using C# and the Cryptography package that comes included with .NET. [sc name="github"...
In this article, we are going to learn how generic attributes help us implement better custom attributes through a practical example. [sc name="github" url="https://github.com/CodeMazeBlog/CodeMazeGuides/tree/main/csharp-advanced-topics/GenericAttributesInCSharp"...
Manipulating JSON objects is a common operation in applications. In this article, we will look at different ways of iterating over JSON objects in C#. [sc name="github" url="https://github.com/CodeMazeBlog/CodeMazeGuides/tree/main/json-csharp/IteratingOverJsonObject"...