Search
Case insensitive dictionary in C#
By Tan Lee Published on Jan 21, 2025 313
Dictionaries in C# are case sensitive by default when using string keys.
Read moreDeserialize JSON to Dynamic Object Using Newtonsoft.Json in C#
By Tan Lee Published on Jan 21, 2025 636
When you need to deserialize JSON without creating multiple classes, you can either deserialize it to a dictionary or to a dynamic object using Newtonsoft.Json.
Read moreHow to Pass in a Func to override behavior in C#
By Tan Lee Published on Jan 21, 2025 169
In C#, if I want to change the behavior of a method from the outside, I can pass in a function pointer. This technique exists in most programming languages and can be used to implement patterns like the Strategy Pattern.
Read moreHow to Get a file’s checksum using any hashing algorithm in C#
By Tan Lee Published on Mar 20, 2025 161
This article demonstrates how to calculate a file’s checksum using several hashing algorithms, including MD5, SHA1, SHA256, SHA384, and SHA512.
Read moreHandle a faulted Task’s exception in C#
By Tan Lee Published on Mar 20, 2025 176
When a Task throws an exception and ceases execution, it becomes "faulted." The key question is: how do you access the exception thrown by a faulted Task?
Read moreHow to use format strings with string interpolation in C#
By Tan Lee Published on Mar 20, 2025 127
In C#, interpolated strings follow this structure: {variable:format}, where the format part is optional. Normally, the interpolated string would look like this: $"My name is {name}".
Read moreHow to Check if an IP range is valid in C#
By Tan Lee Published on Mar 20, 2025 145
If you have an IP range defined by a starting and ending IP address (e.g., from user input or a configuration file), you can validate it using the following steps:
Read moreMerge two dictionaries in-place in C#
By Tan Lee Published on Mar 20, 2025 127
When merging two dictionaries, you have the option to either perform the merge in-place or create a new dictionary and copy the values over.
Read moreGenerating XML Documentation and Including It in a NuGet Package in C#
By Tan Lee Published on Mar 20, 2025 179
XML documentation comments in C# serve two main purposes:
Read moreHow to Read a custom config section from app.config in C#
By Tan Lee Published on Mar 20, 2025 154
In this article, I’ll show you how to retrieve a custom configuration section from app.config and load it into your own configuration class.
Read moreHow to use GROUP BY in SQL
By Tan Lee Published on Mar 07, 2025 138
You can use the GROUP BY clause in SQL to organize rows based on one or more columns. This creates a single row per group in the result, where each group contains the columns used for grouping and the aggregated results of functions like COUNT, MIN, MAX, AVG, or SUM.
Read moreFiltering GROUP BY with HAVING and WHERE in SQL
By Tan Lee Published on Mar 07, 2025 171
In SQL, you can filter the results of a GROUP BY query in two ways:
Read moreUsing GROUP BY with ORDER BY in SQL
By Tan Lee Published on Mar 07, 2025 199
The GROUP BY clause groups rows based on one or more columns, while the ORDER BY clause sorts rows. You can combine these two to sort the groups themselves.
Read moreAggregate functions with GROUP BY in SQL
By Tan Lee Published on Mar 07, 2025 251
In SQL, there are five primary aggregate functions: COUNT(), SUM(), AVG(), MIN(), and MAX(). These functions calculate summary values for sets of rows. When used with the GROUP BY clause, they generate summary values for each group.
Read moreJSON object contains a trailing comma at the end which is not supported
By Tan Lee Published on Mar 07, 2025 229
To fix the error 'JSON object contains a trailing comma at the end which is not supported', you need to modify your JSON and/or the deserialization settings.
Read moreHow to Share a file between multiple projects in Visual Studio
By Tan Lee Published on Mar 06, 2025 273
When you need to share a file across multiple projects without duplicating its contents, you can create a link to the existing file.
Read moreHow to set multiple startup projects in Visual Studio
By Tan Lee Published on Mar 06, 2025 251
Since Visual Studio 2019, you can configure multiple startup projects within the solution properties.
Read moreHandling CSV Files Without a Header Row Using CsvHelper
By Tan Lee Published on Mar 06, 2025 223
When working with CSV files that lack a header row, CsvHelper requires configuration to map data by field position rather than by header name. In this guide, I will show you how to set it up properly, as well as an alternative manual parsing approach for such cases.
Read moreHow to upload file using AngularJS
By Tan Lee Published on Feb 16, 2024 399
To upload a file in AngularJS with an ASP.NET Web API, you need to set up both the AngularJS frontend and the ASP.NET Web API backend to handle file uploads.
Read moreHow to fix LoginPath not working in ASP.NET Core
By Tan Lee Published on Jun 10, 2024 1.62K
If you’re facing issues with LoginPath in ASP.NET Core, it’s usually related to the configuration of the authentication middleware, typically within the Startup.cs or Program.cs file.
Read moreAsync SSE endpoint in ASP.NET Core
By Tan Lee Published on Mar 04, 2025 179
Server-Sent Events (SSE) allow a client to receive real-time updates from the server. Unlike WebSockets, SSE is a simpler alternative that works over HTTP and is ideal for one-way communication, such as notifications.
Read moreHow to fix System.InvalidOperationException: Scheme already exists: Identity.Application
By Tan Lee Published on Jun 17, 2024 2.41K
The error message System.InvalidOperationException: Scheme already exists: Identity.Application typically occurs when you're trying to add Identity to your ASP.NET Core project, but the scheme "Identity.Application" is already registered in the authentication options.
Read moreHow to use Material Design for .Net WinForms in C#
By Tan Lee Published on Jun 17, 2024 25.78K
There are several third-party frameworks and libraries that bring Material Design components to Windows Forms.
Read moreHow to use Xander UI Framework WinForm App in C#
By Tan Lee Published on May 27, 2024 23.96K
Using Xander UI Framework in a C# Windows Forms Application involves adding the framework's components to your project and utilizing them to enhance the visual appearance and functionality of your forms.
Read moreHow to Append a file in C#
By Tan Lee Published on Jun 25, 2024 816
Appending data to a file in C# can be done using various methods provided by the .NET framework.
Read moreHow to read XML in C#
By Tan Lee Published on Jan 17, 2025 720
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.
Read moreHow to Implement Phone verification, 2FA using ASP.NET Core
By Tan Lee Published on Mar 03, 2025 146
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.
Read moreHow to Implement Passwordless Authentication in ASP.NET Core
By Tan Lee Published on Mar 03, 2025 289
Passwordless authentication is a method that allows users to authenticate without needing to remember and input a password. Instead, authentication is done through alternative methods like email, SMS, or biometrics, ensuring a more convenient and secure experience.
Read moreSequence contains no elements
By Tan Lee Published on Feb 28, 2025 210
When you call .Single() on an IEnumerable that is empty or contains more than one element, you encounter the following exception:
Read moreAction and Func Delegates in C#
By Tan Lee Published on Feb 27, 2025 128
Delegates in C# are a powerful feature found in the System.Delegate namespace. They serve various purposes, but the most common ones are:
Read more