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...
Automatic Registration of Minimal API Endpoints in .NET
In this article, we will explore how we can improve our Minimal API endpoints in .NET with automatic registration. Let's dive...
Comparing Performance of the switch and if-else Statements in C#
In this article, we delve into the performance nuances of switch and if-else statements in C#, two pivotal control flow mechanisms. Through a comparative analysis, we'll explore how each statement impacts application performance under various conditions, supported by...
How to Use StringPool to Reduce String Allocations in C#
In software development, effective memory management plays a pivotal role, acting as a secret sauce to enhance our application's performance. When working with C# code, managing strings, a common task, significantly impacts our program's memory usage. Because .NET...
Fastest Way to Generate a Random Boolean in C#
Generating random boolean values is a common challenge in programming tasks, especially when randomness is required for gaming or testing data. With that said, let's explore some methods to generate boolean values as quickly as possible. [sc name="github"...
How to Send a JSON Object Using HttpClient in .NET
In modern web development, sending JSON objects over HTTP has become a common practice for exchanging data between clients and servers. In this article, we will explore how to send a JSON object using HttpClient. [sc name="github"...
Exception Handling in C#
In this article, we will dive into exception handling, explore user-defined exception creation, and demonstrate implementing a global exception handler in C#. [sc name="github"...
Fastest Way to Get the First N Characters of a String in C#
In this article, we will perform benchmark tests to determine the fastest way to get the first N characters of a string in C#. We will start by creating an input string. Then, we will define and explain different methods that we can utilize to accomplish this task. At...
Get the Date of the First Day In a Week Given the Week Number and a Year In C#
Have you ever asked yourself how to calculate the date of the first day in a week, given the week number and a year in C#? The Gregorian Calendar has fifty-two full weeks and an extra day in a normal year, equivalent to 52.143. However, it also includes leap years...
Code Maze Weekly #205
Issue #205 of the Code Maze weekly. Check out what's new this week and enjoy the read. .NET and C# Top Picks An introduction to the heap data structure and .NET's priority queue [andrewlock.net] A nice breakdown of the heap data structure...
Difference Between Abstraction and Encapsulation in C#
Let's explore the differences between abstraction and encapsulation in C#. Abstraction and encapsulation constitute fundamental concepts in object-oriented programming (OOP) and coexist in C#. Each of them fulfills key roles in the design and implementation of classes...
Architecture Tests in .NET with NetArchTest.Rules
In this article, we'll explore how to use the NetArchTest.Rules library to write architecture tests for our .NET applications. Let's...
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#
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. [sc...
Introduction to Brighter in .NET
Brighter is a feature-rich .NET library for dispatching and processing commands that make it easy to implement in-process and out-of-process processing; moreover, it makes it easy to implement CQRS architecture. In this article, we will learn how to use Brighter in...



