Selection logic is a prominent part of many applications. Whether you add a simple environment toggle, a UI mode decision, or apply a discount, you have to rely on user input. Sometimes, simply using an intuitive if-else or a switch case can work. However, when conditions are growing or a ...
Not all data in your application should live as a standalone table with its own ID and lifecycle. Sometimes you need a tightly coupled dependent object that exists alongside its parent, like a movie's budget, a survey's questions, or a customer's address. If you ...
You can't really argue against the importance of performance in any application. Even if the system is not time-critical, efficient and time-saving operations are cornerstones of the system. Data fetching is the primary step for improving the performance of most applications. If you use Entity Framework Core (EF ...
If you have ever had to generate Excel reports in C#-based applications, you know the pain of choosing from too many libraries with too many tradeoffs. Some are extremely powerful but painful to write, while others are friendly but struggle with large files. You probably come across OpenXML, EPPlus, ...
When talking about Domain-Driven Design (DDD), the repository pattern becomes a default choice for the data access layer. Another pattern is the Specification pattern that organizes code into smaller objects. The question raised here is which suits your project and which is more maintainable as your project scales? I will ...
In the world of .NET, memory management is an important aspect of any application. Fortunately, you don't have to shoulder this immense task yourself. .NET handles it with the superpower of the Garbage Collector (GC). A GC is an engine that keeps your app fast, responsive, and resource-efficient. ...
C# Boxing and Unboxing are vital players in the performance of an application. However, they are often overlooked. They involve heap allocations that bring a penalty due to their accessing mechanism. In today's post, we will unfold Boxing and Unboxing in detail, study how they are costly to ...
Tired of endless if-else blocks just to build queries? What if your LINQ queries could write themselves at runtime? Today, we will unfold expression trees, which can be used to create dynamic queries at runtime. I will show how to use expression trees in your project and understand their advantages ...
Async operations are an integral part of any application. In C#, mostly asynchronous methods return Task or Task<T>, but there's also the odd case of async void. We know void is for synchronous operations, so why does C# even allow async void? I will dissect ...