How To
Enum Generic Type Constraint in C#
By Tan Lee Published on Feb 04, 2025 647
In this post, let's look at how we can use Enum as a generic type constraint in C#. This feature was introduced in C# 7.3 and allows you to enforce that a type parameter is an enum, providing compile-time safety for your generic methods.
How to use Parallel.For and Parallel.ForEach in C#
By Tan Lee Published on Jan 06, 2025 1.35K
Parallel programming in .NET enables more efficient utilization of system resources and provides greater control over program execution.
How to check if a directory is empty in C#
By Tan Lee Published on Dec 25, 2024 1.4K
In C#, there are a couple of straightforward ways to determine whether a directory is empty.
How to Append a file in C#
By Tan Lee Published on Jun 25, 2024 949
Appending data to a file in C# can be done using various methods provided by the .NET framework.
How to convert string to hex in C#
By Tan Lee Published on Nov 26, 2024 2.09K
To convert a string to its hexadecimal representation in C#, you can use the following method.
How to Convert a string to a double in C#
By Tan Lee Published on Feb 04, 2025 786
There are three common ways to convert a string to a double:
How to get project file path in C#
By Tan Lee Published on Nov 13, 2024 3.03K
In C#, you can get the project file path in different ways.
How to read XML in C#
By Tan Lee Published on Jan 17, 2025 1.1K
Parsing XML in C# can be done using several approaches, each suitable for different scenarios depending on the complexity of the XML structure and performance requirements.
How to compress and decompress strings in C#
By Tan Lee Published on Dec 30, 2024 647
Compressing string data using compression algorithms like GZip and Brotli can help reduce memory payload and improve application performance.
How to restart program in C#
By Tan Lee Published on Nov 10, 2024 1.04K
To restart a program in C#, you can achieve it by launching a new instance of the program and exiting the current instance.
Auth with multiple Identity Providers in ASP.NET Core
By Tan Lee Published on Mar 03, 2025 618
To authenticate with multiple identity providers in ASP.NET Core, you can configure different authentication schemes for each identity provider (such as Auth0, Azure AD, or OpenIddict) and handle token validation accordingly.
How to Implement Phone verification, 2FA using ASP.NET Core
By Tan Lee Published on Mar 03, 2025 308
To implement phone verification and Two-Factor Authentication (2FA) using ASP.NET Core, we can extend ASP.NET Core Identity and use an SMS provider to send verification codes.