Search
How to use a list of tuples in C#
By Tan Lee Published on Mar 05, 2025 393
In C#, a list of tuples can be used to store a collection of data where each element contains multiple values.
Read moreHow to Read Excel file in C# using OleDb
By Tan Lee Published on May 27, 2024 10.72K
To read an Excel file in C# without using Interop and to get Excel sheet names using OleDb provider, you can follow these steps.
Read moreHow to Encrypt and Decrypt files using AES encryption algorithm in C#
By Tan Lee Published on Jul 16, 2024 26.63K
Encrypting and decrypting files using AES encryption in a C# Windows Forms application involves several steps.
Read moreHow to zoom an image in C#
By Tan Lee Published on Jul 02, 2017 16.88K
To zoom an image in a PictureBox in C#, you can manipulate the Image property of the PictureBox by adjusting the SizeMode and scaling the image.
Read moreHow to Print a Picture Box in C#
By Tan Lee Published on Jul 16, 2024 20.82K
Printing an image from a PictureBox control in a C# Windows Forms Application involves several steps, including setting up a PrintDocument, handling the print page event, and managing printing settings.
Read moreSQL Bulk Insert with SqlBulkCopy in C#
By Tan Lee Published on Mar 19, 2025 140
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 Use SqlDataReader to process multiple result sets in C#
By Tan Lee Published on Mar 19, 2025 165
In this article, I'll demonstrate how to use the SqlDataReader ADO.NET class in two scenarios involving multiple result sets:
Read moreHow to use SqlBulkCopy in C#
By Tan Lee Published on Dec 13, 2024 590
SqlBulkCopy is a class in the System.Data.SqlClient namespace in C# that provides an efficient way to bulk load data into SQL Server databases.
Read moreHow to Deserialize JSON that Contains an Embedded JSON String in C#
By Tan Lee Published on Mar 19, 2025 145
In this article, I'll demonstrate how to handle deserializing JSON that contains an embedded JSON string, which I'll refer to as a "JSON package." This concept is like receiving a gift box (the JSON package) that contains a smaller gift (the embedded JSON data) inside it.
Read moreHow to use JsonConverterFactory in C#
By Tan Lee Published on Mar 14, 2025 288
To use a JsonConverterFactory in C#, you need to create a custom JsonConverterFactory subclass and implement the necessary methods.
Read moreHow to check if a directory is empty in C#
By Tan Lee Published on Dec 25, 2024 1.09K
In C#, there are a couple of straightforward ways to determine whether a directory is empty.
Read moreHow to Upload a file to Web API in C#
By Tan Lee Published on Jul 16, 2024 21.58K
To upload files and submit form data to an ASP.NET Core Web API using RestSharp in a C# Windows Forms application, you can follow these steps.
Read moreHow to receive a file in a web API request in ASP.NET Core
By Tan Lee Published on Mar 01, 2025 294
When a client uploads a file in a multipart/form-data request, it is captured in an IFormFile object. This object contains metadata about the file, such as the file's name, and exposes the file's content as a stream, enabling you to either save or process the file as needed.
Read moreHow to receive requests with XML content in ASP.NET Core
By Tan Lee Published on Mar 01, 2025 105
Receiving requests with XML content in ASP.NET Core is quite simple. You only need to register the built-in XML InputFormatter to handle XML content, otherwise, you'll encounter 415 – Unsupported Media Type errors.
Read moreHow to Create a backup SQL Server in C#
By Tan Lee Published on Jul 16, 2024 9.71K
Creating a full database backup in a C# Windows Forms application involves using SQL Server Management Objects (SMO) from the Microsoft.SqlServer.Smo assembly.
Read moreHTML5 Validation for ASP.NET Core
By Tan Lee Published on Feb 27, 2025 162
While working on an ASP.NET Core project, I wanted to improve the efficiency of client-server interactions by ensuring that only valid requests were made. This is something HTMX supports by default when you use HTML5 validators on forms and input fields.
Read moreUsing HTML Range Inputs with ASP.NET Core TagHelpers
By Tan Lee Published on Feb 27, 2025 173
HTML offers a variety of input fields that can significantly enhance user experiences. As of this writing, there are 22 HTML input types, and the InputTagHelper in ASP.NET Core supports 14 of them, based on .NET common language runtime types in your models.
Read moreHow to use the FromServices attribute in ASP.NET Core
By Tan Lee Published on Feb 26, 2025 158
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.
Read moreHow to round up in C#
By Tan Lee Published on Nov 05, 2024 820
In C#, rounding is typically done using the Math.Round() method.
Read moreHow to use Advanced Filter DataGridView in C#
By Tan Lee Published on Mar 19, 2024 28.04K
Filtering a DataGridView by columns in C# using the Advanced DataGridView control involves several steps including setting up the control, handling user input for filtering, and applying filters dynamically.
Read moreCapturing screenshots in C#
By Tan Lee Published on Feb 17, 2025 367
Capturing screenshots in C# can be done in several ways, depending on the specific requirements of your application (e.g., capturing the entire screen, a specific window, or a selected region).
Read moreHow to use GeckoFx Web Browser in C#
By Tan Lee Published on Jun 08, 2024 9.77K
GeckoFX is an embedded browser component leveraging Mozilla's Gecko rendering engine for use in C# Windows Forms applications involves a few steps.
Read moreHow to Create a Fluent Design Form in C#
By Tan Lee Published on Jul 13, 2024 18.12K
Creating a Fluent Design Form in a C# Windows Forms Application using DevExpress involves leveraging DevExpress's Fluent Design Form components and adjusting the appearance settings to achieve the desired Fluent Design style.
Read moreDownload backup of Northwind database for SQL Server
By Tan Lee Published on Nov 13, 2024 515
To get the Northwind sample database for SQL Server, you can follow one of the steps below.
Read moreCould not load file or assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies
By Tan Lee Published on May 14, 2024 14.08K
This error occurs because the required assembly, netstandard, Version=2.0.0.0, is not found or there’s a mismatch in dependencies in your project.
Read moreTwo-Factor Authentication with Google Authenticator in ASP.NET Core
By Tan Lee Published on Feb 11, 2025 353
In this article, we’ll walk through the steps to implement two-factor authentication (2FA) in your ASP.NET Core web application using Time-Based One-Time Password (TOTP) apps like Google Authenticator and Authy.
Read moreHow to Implement Passkey Authentication in ASP.NET Core
By Tan Lee Published on Feb 11, 2025 425
In today’s digital world, securing user data while providing a seamless authentication experience is crucial. One of the most promising ways to achieve this is through Passkey authentication.
Read moreHow to use data annotations in C#
By Tan Lee Published on Jan 06, 2025 557
Data annotations are attributes from the `System.ComponentModel.DataAnnotations` namespace that can be applied to classes or class members.
Read moreHow to Clone Objects with Object.create in Javascript
By Tan Lee Published on Feb 08, 2025 149
To clone an object using Object.create in JavaScript, you can create a new object and set the prototype of the new object to be the object you want to clone.
Read moreFixing Invalid Parameter Type in Attribute Constructor
By Tan Lee Published on Dec 21, 2024 452
When attempting to pass a parameter to the constructor of a custom attribute, you may encounter one of the following compiler errors:
Read more