Tag Archives: C#

Design Patterns – Asynchronous Factory

By | 13/03/2024

In this post, we will see how to use the Asynchronous Factory Method pattern in our project.But first of all, what is Asynchronous Factory Method and why should we use it?“In many applications, especially those that involve database operations, initializing data asynchronously during startup is a common requirement. However, constructors in C# do not support… Read More »

C# – Concurrent collections

By | 06/03/2024

In this post, we will see some concurrent collections that we could use in our multi-threaded application where, managing shared data between threads, can introduce complexity and potential error such as race conditions or deadlocks. .NET addresses these cases with its concurrent collections, found in the System.Collections.Concurrent namespace. These collections are designed to be thread-safe… Read More »

Minimal APIs – Serilog

By | 07/02/2024

In this post, we will see how to use Serilog in our Minimal APIs projects.Serilog is a diagnostic logging library fro .NET applications and we have seen it in the post:C# – Serilog.The Minimal API project that we are going to use here, is the project that we have used in all previous Minimal APIs’… Read More »

C# – Serilog

By | 24/01/2024

In this post, we will see how to use Serilog in our .net applications.But first of all, what is Serilog?Serilog is a diagnostic logging library for .NET applications. It is designed to be easy to configure and extend, offering a rich set of sinks (outputs) and enrichers. One of the key features of Serilog is… Read More »

Category: C# Tags:

Unit Test – Fluent Assertions

By | 18/10/2023

In this post, we will see what “Fluent Assertions” is and how we can use it in our projects.But first of all, what is “Fluent Assertions”?Fluent Assertions is a popular library for writing more expressive and readable unit tests in C#. It provides a fluent, natural language syntax for asserting the behaviour of our code.For… Read More »

C# – Span

By | 09/08/2023

In this post, we will see what is Span<T> in C# and how we can use it to improve performance.But first of all, what is a Span<T>?From Microsoft web site:“System.Span<T> is a new value type at the heart of .NET. It enables the representation of contiguous regions of arbitrary memory, regardless of whether that memory… Read More »

Category: C# Tags:

C# – Dapper vs EF for CRUD operations

By | 12/07/2023

In many articles and websites, there are many examples of how Dapper is faster than EF to select data in a database.In this post instead, I want to check if Dapper is faster than EF for some CRUD operations like Insert, Update and Delete.I have this curiosity because I have seen that there is an… Read More »

Category: C# Tags:

C# – Optimizing performance with Parallel.For

By | 21/06/2023

In this post, we will see how to use Parallel.For to optimize the performance of our applications.But first of all, what is Parallel.For?“The Parallel For loop is part of the System.Threading.Tasks namespace introduced in .NET Framework 4.0. It provides a convenient way to divide a loop iteration into smaller, independent tasks that can be executed… Read More »

Category: C# Tags: