Latest Posts On Code Maze

How to Create an Outer Join in LINQ – (Left and Right)

How to Create an Outer Join in LINQ – (Left and Right)

In this article, we'll discuss how to create an outer join in LINQ. Most used are left and right outer join, but we'll also talk about less common ones. It's hard to find an application that doesn't rely on data. We often use just a single data source. But sometimes...

Read a Text File Without Specifying the Full Path in C#

Read a Text File Without Specifying the Full Path in C#

In .NET applications, reading text files is essential for tasks like loading configurations, processing data, and parsing logs. In this article, we look at the file's relative and absolute paths and set up a new project to read a text file using its relative path. Tuples are a useful and practical .NET structure. In this article by David...

How to Fix CORS Error With AnyOrigin and AllowCredentials

How to Fix CORS Error With AnyOrigin and AllowCredentials

In this article, we will learn how to fix the CORS protocol error with AnyOrigin and AllowCredentials in ASP.NET Core (The CORS protocol does not allow specifying a wildcard (any) origin and credentials at the same time). We assume you know the basics of CORS and how...

Difference Between Build and Publish in Visual Studio

Difference Between Build and Publish in Visual Studio

Has anyone ever wondered about the difference between the build and publish functions in software development? As we know, both the build and publish are important steps in software development, especially when using Visual Studio for .NET applications.  Let’s check...

Single and Split Queries in Entity Framework Core

Single and Split Queries in Entity Framework Core

Entity Framework Core (EF Core) offers developers two powerful querying strategies: Single and Split Queries. In this article, we'll delve into the pros and cons of each, helping us make informed decisions for efficient data retrieval. The sample in our repository...

Clean Architecture in .NET

Clean Architecture in .NET

In this article, we are going to discuss Clean Architecture in .NET. So let's get going. [sc name="videolink" videotitle="Clean Architecture with...

How To Check if a URL Is Valid in C#

How To Check if a URL Is Valid in C#

In the world of web development using .NET, it's crucial to make sure the web addresses (URLs) our application uses are correct and safe. In this article, we will understand the basics of how to check if a URL is valid in C#. We'll include some easy-to-understand code...

Using Serilog with Microsoft’s ILogger API

Using Serilog with Microsoft’s ILogger API

In this article, firstly we will explore how to integrate the Serilog logging package with Microsoft's ILogger API. We will then compare the output of both logging methods to highlight the difference. If you're new to Serilog, we recommend reading our article...

How to Get the Number of Weekdays Between Two Dates in C#

How to Get the Number of Weekdays Between Two Dates in C#

Manipulating date and time values is a common programming problem in many applications. Have you ever wondered how we can calculate the number of weekdays between two dates? Knowing how to do this can be crucial in scheduling, project management, or resource...

How to Get the Number of Lines in a Text File in C#

How to Get the Number of Lines in a Text File in C#

In C#, understanding how to count lines in a text file efficiently is a fundamental skill. This seemingly simple task is essential, especially in data manipulation, analysis, or validation scenarios. Whether we are dealing with log files, configuration files, or large...

Parallel.ForEachAsync() and Task.Run() With When.All in C#

Parallel.ForEachAsync() and Task.Run() With When.All in C#

Parallel programming is a common and broad concept in the .NET world. In this article, we compare two well-known methods we use to achieve it when running a repetitive asynchronous task. We take a look at how they behave under the hood and compare the pros and cons of...

Calculate the Difference in Months Between Two Dates in C#

Calculate the Difference in Months Between Two Dates in C#

Calculating the difference in months between two dates is a useful skill for C# developers. Having this knowledge helps us in tasks such as subscription management and tracking course durations. In this article, we learn how to use DateOnly, DateTime, and TimeSpan...

How to Check if a Number Is Positive or Negative in C#

How to Check if a Number Is Positive or Negative in C#

In programming, it is very crucial to figure out whether a number is positive or negative. This article will walk through different ways to do that in C#. We will discuss in detail some of the very common ways to evaluate if a number is positive or negative,...