Latest Posts On Code Maze

How to Configure Rolling File Logging With Serilog

How to Configure Rolling File Logging With Serilog

Logging holds a crucial role in software development, as it provides software engineers valuable insights into the behavior and health of their applications. Moreover, Serilog, a popular logging framework for .NET applications, offers a wide range of features. One...

ModuleInitializer Attribute in C#

ModuleInitializer Attribute in C#

As a C# developer, you might have overlooked the ModuleInitializer attribute introduced in version 9 of the language. This attribute is a hidden gem in the extensive BCL APIs and designates a method that the runtime should first invoke when loading the assembly....

Techniques for Sorting a List in C#

Techniques for Sorting a List in C#

In this article, we will explore different techniques for sorting a list. A common task we face as developers is the need to sort a collection of data. The C# language provides us with a variety of ways in which we can accomplish this task. To help us have a better...

Value vs Reference Types in C# – In Depth Guide

Value vs Reference Types in C# – In Depth Guide

In this article, we will learn about the categories of C# data types. We will deep dive into the differences between value types and reference types, what are they and what's the behavior of each type when instantiated, compared, or assigned. It's important to...

What Is Model Builder and How to Use It in ML.NET

What Is Model Builder and How to Use It in ML.NET

In this article, we will take a look at ML.NET Model Builder for Visual Studio. Following our introductory article on ML.NET, in this one, we will learn what it is and how to use it in our projects. [sc name="github"...

Source Generators in C#

Source Generators in C#

Traditionally, code generation in C# involved using external tools or templates to generate code before the compilation process, like the T4 template. However, with source generators, code generation becomes an integral part of the compilation itself. In this article,...

How to Merge Dictionaries in C#?

How to Merge Dictionaries in C#?

In this article, we will explore several ways of how to merge dictionaries in C# and compare their performance to help you choose the best option for your specific use case. [sc name="github"...

Effective Mocking With NSubstitute in .NET

Effective Mocking With NSubstitute in .NET

In this article, we will delve into the world of mocking with NSubstitute in .NET and explore how it can help us create comprehensive and efficient tests for our projects. [sc name="github"...

What is Locking and How to Use a Locking Mechanism in C#

What is Locking and How to Use a Locking Mechanism in C#

 In this article, we will discuss the locking mechanism in C#. We will explain what locking is and why we need it. We will demonstrate and explain different ways how we can use the mechanism.  [sc name="github"...

Sending Email With FluentEmail in .NET

Sending Email With FluentEmail in .NET

In this article, we are going to learn how to send emails using FluentEmail in an ASP.NET Core Web API application. FluentEmail is a popular open-source library for sending emails from .NET applications. It provides an easy-to-use fluent interface. That means we can...

XML Deserialization in C#

XML Deserialization in C#

In the world of C#, XML deserialization is a powerful technique that allows developers to convert XML data into strongly typed objects seamlessly. That said, in this article, we will learn more about XML deserialization in C#. We will cover essential concepts, hence,...

Saga Pattern With NServiceBus in C#

Saga Pattern With NServiceBus in C#

Navigating the world of distributed systems and microservices in C#? Then we should appreciate the combination of the Saga Pattern and NServiceBus. This powerful pairing provides us with an efficient solution for coordinating long-running, distributed transactions in...

Should We Use Records or Classes or Structs in C#

Should We Use Records or Classes or Structs in C#

Classes and structs have been a part of C# since version 1.0, but more recently records have been added. In this article, we will compare these three structures to see how they each have a use-case where they are the best data structure to use. [sc name="github"...

How to Solve Unable to Resolve Service for a Type

How to Solve Unable to Resolve Service for a Type

Dependency Injection plays a crucial role in building maintainable applications in .NET Core. It helps in building loosely coupled services that are scalable and less prone to bugs in the long run. However, sometimes we might encounter the error message "Unable to...

Introduction to Scrutor Library in .NET

Introduction to Scrutor Library in .NET

In this article, we will explore the Scrutor library, learn about its use cases, what it offers to simplify dependency injection, and the implementation of cross-cutting concerns using the decorator pattern. [sc name="github"...

How to Efficiently Randomize an Array in C#

How to Efficiently Randomize an Array in C#

In this article, we will look at how we can efficiently randomize an array in C#. We'll explore several ways of achieving that and then we'll compare the performance of each approach. [sc name="github"...