How to Validate a GUID in C#
In this article, we will explore several approaches to validate a string representation of a GUID in C#. So let's dive in. What Does...
Generate Sortable Unique IDs With the NewId Library in .NET
In this article, we'll explore why we might need sortable unique IDs in .NET and how to create them with the NewId NuGet Package. ...
Different Ways to Create a Generic List of Anonymous Types in C#
Knowing how to manipulate complex datatypes such as Lists is crucial when storing and manipulating data in C#. Sometimes, we may want to incorporate versatility by not having to define explicit classes and create generic lists of anonymous types in C#. In this...
The Fastest Way to Remove the Last Character of a String
Creating and manipulating string objects can be useful when building applications. In the C# programming language, string objects contain text values stored as a sequential read-only collection of character objects. This means string objects are immutable and thus...
Fastest Way to Check if a List is in Order in C#
In this article, we'll examine different techniques to check whether or not a list is in order in C#. We'll begin by examining several techniques, including parallel processing. Finally, we'll run a series of benchmarks to help us choose which option fits best in our...
How to Get the HTML Content of a Web Page as a String in .NET
In this article, we will look into a comprehensive guide on how to get the HTML content of a web page as a string and how to parse the content retrieved. First things first, we'll learn how to retrieve HTML content as a string from the web using tools like HttpClient,...
How to Use Entity Framework Core Migrations in Production
In this article, we will discuss the different approaches to migrating a production database when using Entity Framework (EF) Core code-first migrations. [sc name="github"...
How to Reverse a Number as an Integer and Not as a String in C#
In this article, we will dive into various ways to reverse a number using integer reversal. We will begin by exploring the iterative approach, which breaks down numbers into individual digits and rebuilds them in reverse order. Next, we will discuss recursion as an...
What’s the Best Way to Count the Digits in a Number
In this article, we examine how to count the digits in a number, using C#. Finding the number of digits of an integer is a common problem in informatics. For instance, it's useful when we need to convert numbers from one numerical system to another, or when we want to...
Best Practices for Logging With Serilog
In this article, we'll take a look at some best practices when it comes to logging in .NET with Serilog. Logging is essential to any application we build and Serilog is one of the major logging providers. For this reason, we've prepared some Serilog best practices to...
Why Do We Use the Virtual Keyword for Class Properties in EF Core?
Many .NET applications use Entity Framework Core (EF Core), a popular ORM framework. It offers three distinct approaches to loading related data - eager loading, lazy loading, and explicit loading. In this article, we will focus on the mechanism of lazy loading and...
How to Convert ReadOnlyMemory to a Byte Array in C#
In this post, we delve into C# memory structures, focusing on ReadOnlyMemory<T> and byte[] types. We aim to understand how to convert ReadOnlyMemory to a byte array, specifically using the MemoryMarshal.AsBytes() method. We also explore scenarios where this...
How to Benchmark a Method’s Performance Across Different .NET Versions
As .NET developers, we often benchmark the performance of our methods using a single .NET version. However, we can also benchmark a method's performance across different .NET versions. Such benchmarks can come in handy when we want to upgrade our codebase to a newer...
How to Convert IAsyncEnumerable to List
In this article, we will learn how to convert IAsyncEnumerable to a List in C#. We'll talk about some practical reasons for this conversion and explore the common method for achieving it. [sc name="github"...
How to Convert String to Char in C#
In C# development, working with strings and characters is essential. This article explores how to convert a string to a char array. It also extends into converting arrays of strings to arrays of characters. [sc name="github"...
Using Memory For Efficient Memory Management in C#
Effective memory management is a crucial aspect of programming languages, especially when performance and efficiency are paramount. In C#, developers have access to a powerful API, Memory<T>, enabling them to work flexibly and efficiently with memory. In this...
Execute the SELECT WHERE NOT EXIST SQL Query Using LINQ
In database querying, the SELECT WHERE NOT EXISTS clause plays a pivotal role in retrieving data based on the absence of certain conditions. This is particularly useful when filtering records that do not have corresponding entries in another table. In this article, we...
Different Methods for Computing the Size of a Directory in C#
In this article, we look into various ways to calculate the size of a directory. Applications dealing with file management or storage inevitably need to know how much space a directory takes up. Calculating the directory size helps with disk space management as we can...
How to Resolve IOptions Instance Inside Program Class in C#
In this article, we’ll look at resolving the IOptions instance in the Program class, ensuring we avoid common pitfalls and learn some best practices. As software developers, we frequently encounter the challenge of managing application configurations. However, to make...
Why Should We Avoid Using Await in a Loop in C#
It is essential to carefully consider when to use the await keyword in a for or for-each loop to prevent inefficiency and performance issues in software development. In this article, we will explore scenarios where using the await keyword in a loop is appropriate and...
Difference Between await and Task.Wait in C#
In this article, we will discuss the differences between await and Task.Wait() in C# and .NET. We will start by looking into concepts like Blocking Code and Asynchronous Programming. We will see how we can use await and Task.Wait() in our code and their effects on our...


