How To

How to use the FromServices attribute in ASP.NET Core
By Tan Lee Published on Feb 26, 2025 143

ASP.NET Core has built-in support for dependency injection, allowing components to be injected at runtime. This makes your code more flexible, testable, and maintainable. Dependency injection can be performed in three ways: constructor injection, setter injection, and interface injection.

How to use the Developer Exception Page in ASP.NET Core
By Tan Lee Published on Feb 26, 2025 176

The Developer Exception Page in ASP.NET Core is a useful feature that helps developers troubleshoot errors during development by providing detailed error information, stack traces, and request data.

How to Implement authorization for Swagger in ASP.NET Core
By Tan Lee Published on Feb 26, 2025 458

When developing .NET applications, generating API documentation is often a necessary step. One of the most commonly used tools for this purpose is Swagger.

SortBy, FilterBy, and CombineBy in .NET 9
By Tan Lee Published on Feb 22, 2025 136

In this article, I will explore the new LINQ methods SortBy, FilterBy, and CombineBy introduced in .NET 9. These powerful features enhance LINQ’s functionality and flexibility, making it even more valuable for developers.

Chunking HTTP Cookies in ASP.NET Core
By Tan Lee Published on Feb 26, 2025 254

If you've spent any time in web development, you know that cookies are a fundamental part of how we maintain state in web applications. For today's discussion, we're talking about HTTP cookies, which are simply key-value pairs set by the server via the Set-Cookie header.

ConcurrentDictionary and Closures in .NET
By Tan Lee Published on Feb 26, 2025 211

This post aims to clarify closures, explain the potential issues they create, and demonstrate how to avoid closures when working with ConcurrentDictionary in .NET.

Using Strongly-Typed Markdown in ASP.NET Core
By Tan Lee Published on Feb 26, 2025 203

Using Markdown in an ASP.NET Core application is a great way to manage content, especially when working with static content or content management systems (CMS).

How to round up in C#
By Tan Lee Published on Nov 05, 2024 786

In C#, rounding is typically done using the Math.Round() method.

Comparing IP Addresses in C#
By Tan Lee Published on Jan 16, 2025 493

Comparing two IP addresses in .NET can be surprisingly tricky.

Filtering Collections in LINQ
By Tan Lee Published on Feb 25, 2025 109

The Where operator in LINQ works as a filter, allowing you to query a collection (like a list, array, or any other enumerable data) and return only the elements that meet a specific condition.

Element Operators in LINQ
By Tan Lee Published on Feb 22, 2025 93

In this article, we will explore LINQ's Element Operators, their functions, and how they help in extracting elements from collections.

Inner Join Using LINQ And Lambda
By Tan Lee Published on Feb 22, 2025 111

An inner join returns only those records or rows that exist in both tables, meaning it gives us the matching rows from both tables.