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
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#
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#
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 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#
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 Call SignalR Hub from Controller in ASP.NET Core
In this article, we will look at how to call a SignalR Hub from an ASP.NET Core controller. If you are unfamiliar with setting up SignalR in your server and/or client application, check out our article for more information. [sc name="github"...
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,...
How to Check if a String Contains Only Letters in C#
In this article, we'll explore different alternatives to check if a string contains only letters in C#. We will learn the characteristics of each approach, discuss the benefits of each one, and choose the one that best fits each situation. [sc name="github"...
How to Check if an Object Is a Number in C#
In this article, we will explore different methods to check if an object is a number. C# is a strongly typed programming language, which ensures...
Creating Conditional Required Attributes for Validation in .NET Web API
Whether seasoned or just getting started in the .NET world, we've all encountered situations where we need to conditionally validate some attributes of data based on specific conditions. In this article, we're going to learn about creating conditional required...
How to Log a Class and Method Names Using Serilog
Developers must implement an efficient logging system to maintain and troubleshoot applications effectively. One popular logging library that provides powerful logging capabilities is Serilog. In this article, we will talk about how to log class and method names using...
How to Overwrite DateTime.Now During Testing in .NET
In this article, we'll look closer at how we can overwrite the DateTime.Now property when testing applications in .NET. Let's dive in!...
New Features in C# 12
In this article, we will explore new features in C# 12. We will describe primary constructors, collection expressions, inline arrays, and other newly introduced features. We'll need the latest Visual Studio 2022 or .NET 8 SDK to try each of these new C# 12 features,...
Using Fluxor for State Management in Blazor
In this article, we will review the Flux pattern with its benefits, and drawbacks in general. Then we will take a look into how Fluxor implements this pattern. Finally, we will learn how to use the library using an example Blazor application. [sc name="github"...
What Is the Difference Between Properties and Fields in C#
In this article, we will learn about the difference between Properties and Fields in C#, and how to use them. Let's...
Different Techniques to Convert a Number Between Hexadecimal and Decimal in C#
Manipulating numerical data is fundamental to many applications. In some cases, we may need to convert numbers between different bases. This article explores different ways to convert a number between hexadecimal and decimal in C# while offering insights into the...
Different Ways to Validate an Uploaded File in ASP.Net Core
As developers, we often tend to oversee the security of our applications. Whether the user misclicks on the wrong file or purposely uploads a malicious one, we should always validate the input loaded through our application. In this article, we'll look at a few...
How to Get the Number of Files in a Folder With C#
In this article, we are going to see how to get the number of files in a folder. C# provides several methods to determine file counts within a folder, each tailored for specific use cases. [sc name="github"...
The Difference Between RESTful APIs and Web APIs Using ASP.NET Core
In this article, we will discuss the difference between RESTful APIs and Web APIs using the ASP.NET Core framework. We'll begin by explaining what exactly an API is. Then, we'll explain the meaning of REST and RESTful. After that, we will delve into Web APIs. Finally,...
Parsing HTML With AngleSharp in C#
In this article, we will be exploring parsing HTML with AngleSharp in C#. AngleSharp is a powerful library in C# that gives us the ability to parse angle bracket-based hyper-texts like HTML, SVG, MathML, as well as XML. Our focus in this article will be to introduce...




