Search
How to use Async Await in C#
By Tan Lee Published on Dec 07, 2024 405
This C# async/await tutorial explains how to use the async and await keywords to write asynchronous code in C#.
Read moreHow to use TLS 1.2 in C#
By Tan Lee Published on Dec 27, 2024 661
.NET Framework 4.0 (and earlier versions) support SSL 3.0 and TLS 1.0, with TLS 1.0 being the successor of SSL 3.0.
Read moreHow to use Random in C#
By Tan Lee Published on Dec 14, 2024 268
In C#, the Random class is used to generate random numbers.
Read moreHow to Build a Metro-Style Web Browser with Tabs in C#
By Tan Lee Published on May 26, 2017 7.79K
Creating a Metro-style web browser with tabs using the Modern UI in C# is a fun project that incorporates the use of Windows Forms and the WebBrowser control.
Read moreHow to Connect and Use Local Database in Visual Studio 2019
By Tan Lee Published on Jul 16, 2024 31.4K
To connect and use a local database in a C# Windows Forms application using Visual Studio 2019, you can follow these steps.
Read moreHow to Connect to MS Access Database in C#
By Tan Lee Published on Jun 10, 2024 17.31K
To connect to a Microsoft Access database (.mdb or .accdb file) in a C# Windows Forms Application, you can use the OleDbConnection class from the System.Data.OleDb namespace.
Read moreHow to Generate Excel Report in C#
By Tan Lee Published on Jul 13, 2024 11.39K
Generating an Excel report using ClosedXml.Report in a C# Windows Forms Application involves setting up ClosedXML and ClosedXml.Report packages, designing a template Excel file with placeholders, and populating it with data programmatically.
Read moreHow to Create Login Window with User Authentication in C#
By Tan Lee Published on Jan 20, 2021 34.18K
Creating a login window with user authentication in a C# Windows Forms application involves several steps.
Read moreC# LINQ Tutorial
By Tan Lee Published on Mar 27, 2025 98
LINQ (Language-Integrated Query) is a powerful feature in C# and VB.NET that allows for querying data directly within the language.
Read moreC# LINQ query and method syntax
By Tan Lee Published on Mar 27, 2025 98
LINQ is its flexibility, offering two distinct ways to write queries: query syntax and method syntax.
Read moreHow to update UI from another thread in C#
By Tan Lee Published on Dec 21, 2024 2.42K
In C#, you cannot directly update the UI from a background thread because Windows Forms and WPF (UI frameworks) require UI updates to happen on the main UI thread.
Read moreHow to use named tuples in C#
By Tan Lee Published on Mar 05, 2025 168
Tuples allow you to store multiple values together, which can be useful for passing around related data.
Read moreHow to round up in C#
By Tan Lee Published on Nov 05, 2024 844
In C#, rounding is typically done using the Math.Round() method.
Read moreHow to Custom color of Progress Bar in C#
By Tan Lee Published on Jul 17, 2024 11.01K
To create a custom background color for a progress bar in C#, you can create a CustomProgressBar class inherit from the ProgressBar control, then override the OnPaint method.
Read moreDependency inject BackgroundService into controllers
By Tan Lee Published on Feb 04, 2025 173
To inject a BackgroundService into controllers in ASP.NET Core, you can't directly inject it through constructor injection like a normal service.
Read moreSorting JArray in C# with Newtonsoft.Json
By Tan Lee Published on Jan 09, 2025 270
Although you can't directly sort a JArray in C#, you can work around this limitation.
Read moreHow to use IHostedService in ASP.NET Core
By Tan Lee Published on Jan 07, 2025 474
In ASP.Net Core, you can implement background tasks by using Azure WebJobs or various third-party task schedulers such as Quartz or Hangfire.
Read moreScheduling Jobs with Quartz.NET in ASP.NET Core
By Tan Lee Published on Jan 03, 2025 485
Quartz.NET is a job scheduling framework that allows you to schedule background tasks in an ASP.NET Core application, often for tasks that need to run at predefined intervals.
Read moreHow to Run Background Tasks in ASP.NET Core with Hosted Services
By Tan Lee Published on Dec 19, 2024 420
One of the features I appreciate most about .NET Core is how easily it allows you to implement and run background tasks in an ASP.NET Core project.
Read moreImplementing Scheduled Background Tasks in ASP.NET Core with IHostedService
By Tan Lee Published on Dec 19, 2024 763
Scheduled background tasks in ASP.NET Core are essential for tasks that run independently of user interactions, such as sending emails, data processing, or performing system maintenance.
Read moreHow to Download ODBC Driver for SQL Server
By Tan Lee Published on Nov 26, 2024 492
The Microsoft ODBC Driver for SQL Server is a dynamic-link library that provides runtime support for applications using native-code APIs to connect to SQL Server.
Read moreHow to Initialize TagHelpers in ASP.NET Core with Shared Data
By Tan Lee Published on Apr 16, 2025 83
ASP.NET Core’s Razor engine is packed with superpowers. One of the most underrated? The ability to globally initialize TagHelpers with shared data giving you centralized control over UI behavior without repetitive markup or logic.
Read moreEssential Tips for Securing Your ASP.NET Website
By Tan Lee Published on Mar 29, 2025 195
In 2025, securing your ASP.NET website requires staying ahead of emerging threats by adopting robust security strategies and keeping up-to-date with the latest best practices.
Read moreGroup by in LINQ
By Tan Lee Published on Dec 10, 2024 213
In LINQ, the GroupBy method is used to group elements of a collection based on a specified key.
Read moreHow to use sweetalert2
By Tan Lee Published on May 28, 2024 11.9K
Sweetalert2 is a beautiful popup boxes helps you easily show a message box in your website.
Read moreSerializer options cannot be changed once serialization or deserialization has occurred
By Tan Lee Published on Mar 20, 2025 111
When using System.Text.Json, it’s highly recommended to reuse JsonSerializerOptions objects, as this provides a significant speed boost (up to 200 times faster) for subsequent serialization and deserialization operations.
Read moreHow to Query JSON in SQL Server
By Tan Lee Published on Mar 20, 2025 145
Since SQL Server 2016, Microsoft has provided built-in support for managing and querying JSON data. This enables users to store, retrieve, and manipulate JSON documents directly within SQL Server.
Read moreHow to modify JSON in SQL Server
By Tan Lee Published on Mar 20, 2025 170
In SQL Server, there are a couple of ways to modify JSON data within a table:
Read moreBoost Your ASP.NET Core Website Performance with .NET Profiler
By Tan Lee Published on Mar 29, 2025 173
One of the most powerful tools for improving application performance is a .NET Profiler. A profiler helps you understand how your application behaves at runtime, allowing you to pinpoint inefficiencies and optimize code.
Read moreImplementing Two-Factor Authentication with Google Authenticator in ASP.NET Core
By Tan Lee Published on Mar 03, 2025 635
In this article, we'll explore how to implement two-factor authentication (2FA) in an ASP.NET Core web application using Time-Based One-Time Password (TOTP) apps, like Google Authenticator and Authy.
Read moreSQL Bulk Insert with SqlBulkCopy in C#
By Tan Lee Published on Mar 19, 2025 146
When dealing with a large number of records, especially in scenarios where inserting a lot of data into the database, a Bulk Insert can drastically improve performance over executing individual INSERT statements. Bulk Insertion can be up to 20x faster than inserting records one by one.
Read moreHow to batch read with Threading.ChannelReader in C#
By Tan Lee Published on Mar 13, 2025 244
In scenarios involving a consumer/producer model, batching the consumption of items can be highly beneficial. Whether you’re inserting a bulk of records into a database or sending multiple data packets over HTTP, sending individual items one by one can be inefficient.
Read moreJsonException: A possible object cycle was detected
By Tan Lee Published on Mar 13, 2025 215
When serializing objects in .NET, you may encounter a JsonException due to circular references between objects.
Read moreDictionary with multiple values per key in C#
By Tan Lee Published on Dec 20, 2024 3.46K
Each dictionary key in C# maps to exactly one value. However, if you need to store multiple values for a single key, you can use a dictionary of lists.
Read moreHow to read and write to text file in C#
By Tan Lee Published on Jul 04, 2017 11.32K
In C#, reading from and writing to a text file can be done using classes in the System.IO namespace, such as StreamReader, StreamWriter, File, and FileInfo.
Read moreHow to create a composite primary key in EF Core
By Tan Lee Published on Mar 07, 2025 107
A composite primary key is a primary key consisting of more than one column.
Read moreHow to use GROUP BY in SQL
By Tan Lee Published on Mar 07, 2025 141
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 moreHow to use decimal precision and scale in EF Code First
By Tan Lee Published on Jul 11, 2024 1.09K
In C# Entity Framework, when you want to use the Decimal data type for your entity properties, you can follow these steps.
Read moreHow to format number with commas and decimal in Javascript
By Tan Lee Published on Feb 16, 2024 438
In JavaScript, you can format numbers with commas and decimal points using various methods.
Read moreHow to convert string to hex in C#
By Tan Lee Published on Nov 26, 2024 1.72K
To convert a string to its hexadecimal representation in C#, you can use the following method.
Read moreFormat Numbers to 2 Decimals in C# with Dapper
By Tan Lee Published on Jan 09, 2025 320
If you encounter an issue when inserting numeric data into a SQL database using Dapper.
Read moreHow to convert SQL Server's timestamp column to datetime format
By Tan Lee Published on Dec 11, 2024 1.03K
SQL Server's `TIMESTAMP` datatype has no relation to date or time. It is simply a hexadecimal representation of a consecutive 8-byte integer used for versioning, ensuring that a row hasn't been modified since it was last read.
Read moreHow to get the color from a hexadecimal color code using .NET
By Tan Lee Published on Nov 20, 2024 667
To get the color from a hexadecimal color code in .NET, you can use the System.Drawing.ColorTranslator class or directly parse the value using methods provided by the .NET framework.
Read moreHow to convert binary to decimal in C#?
By Tan Lee Published on Nov 15, 2024 303
To convert a binary number to a decimal number in C#, you can manually process the binary digits, or you can use built-in methods like Convert.ToInt32 for a more straightforward approach.
Read moreHow to divide a integer and get decimal in C#
By Tan Lee Published on Oct 29, 2024 910
In C#, when you divide two integers using the / operator, the result is also an integer.
Read moreMerge two dictionaries in-place in C#
By Tan Lee Published on Mar 20, 2025 140
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 moreHow to send a file with HttpClient in C#
By Tan Lee Published on Mar 11, 2025 363
When uploading a file with HttpClient, you need to place the file inside a MultipartFormDataContent object, which will be sent as the body of the HTTP request.
Read moreHow to Remove a list of characters from a string in C#
By Tan Lee Published on Feb 05, 2025 316
When you want to remove a list of characters from a string, you can loop through the list and use string.Replace():
Read moreHow to replace a file in C#
By Tan Lee Published on Jun 12, 2024 838
Replacing a file in C# can be done using the System.IO namespace, which provides classes for working with files and directories.
Read moreSerializing Object with Multiple String Properties to JSON Array in C#
By Tan Lee Published on Jan 14, 2025 420
If you're working with a Property class containing multiple string properties, and you need to serialize it into a JSON array where each string property becomes its own object, you're in the right place.
Read moreSending JSON in .NET Core
By Tan Lee Published on Jan 10, 2025 260
In .NET Core, the Microsoft.Azure.Storage.Queue package has been replaced with the Azure.Storage.Queues package, and the CloudQueueMessage you used to send messages via queue.AddMessageAsync() has been simplified into the SendMessageAsync(string) method.
Read moreReplace {x} tokens in strings in C#
By Tan Lee Published on Jan 10, 2025 348
When working with URLs that contain placeholders (also known as tokens), you may need to dynamically replace those placeholders with actual values at runtime.
Read moreString Token Replacer in C#
By Tan Lee Published on Jan 10, 2025 312
To create a string token replacer in C#, you can implement a simple method that searches for specific tokens (placeholders) in a string and replaces them with corresponding values from a dictionary.
Read moreC# String Format
By Tan Lee Published on Dec 13, 2024 437
In C#, the String.Format method is used to format strings by embedding placeholders within a string and then replacing those placeholders with values.
Read more