C# Record vs. Class: Key Differences and Best Use Cases

C# Record vs. Class: Key Differences and Best Use Cases

When developing in C#, choosing between records and classes depends on the behavior and design of your data structures. Let’s explore their key differences, along with some practical examples.

What Are C# Records?

Records were introduced in C# 9.0 as a way to define immutable, data-centric types. Records focus on representing data rather than functionality.

Read more
Clean Architecture with ASP.NET Core 8 - Part 1

Clean Architecture with ASP.NET Core 8 - Part 1

In today’s fast-paced software development environment, the longevity and maintainability of applications are paramount. This is where Clean Architecture comes into play, especially when implemented within ASP.NET Core 8. By prioritizing a separation of concerns, this architectural style ensures that an application’s core business logic remains unaffected by external dependencies such as databases and user interfaces.

Read more
Understanding Async and Await in C# - A Deep Dive into Modern Asynchronous Programming

Understanding Async and Await in C# - A Deep Dive into Modern Asynchronous Programming

Asynchronous programming has become a cornerstone of modern software development, enabling applications to perform time-consuming tasks without blocking the main thread. In C#, the async and await keywords are pivotal in simplifying asynchronous programming. This blog post provides a comprehensive explanation of these features, including a step-by-step guide on implementing a simple thread pool, using AsyncLocal and ExecutionContext, and creating custom task-like constructs. These insights are ideal for developers looking to enhance their understanding and mastery of asynchronous operations in C#.

Read more
Exploring Locking and Concurrency Control in .NET

Exploring Locking and Concurrency Control in .NET

Locking and concurrency control are essential components in .NET 6, aiding developers in managing how multiple threads access shared resources. These mechanisms prevent data corruption and ensure the correct execution of concurrent operations. This guide delves into the various locking strategies that .NET offers, providing practical examples to illustrate their applications.

Read more
How to limit number of threads in c#

How to limit number of threads in c#

I often use SemaphoreSlim which is a useful utility in .Net and support async await. Below are simple codes which use an extension to ensure that the limited number of threads.

Read more