Search
Dictionary with multiple values per key in C#
By Tan Lee Published on Dec 20, 2024 3.37K
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 Extract the Icon Associated with a File in C#
By Tan Lee Published on Jul 16, 2024 7.17K
You can extract the icon associated with a file in a C# Windows Forms application using the Icon.ExtractAssociatedIcon method from the System.Drawing namespace.
Read moreHow to use reflection to get properties in C#
By Tan Lee Published on Feb 04, 2025 721
In C#, you can use reflection to inspect the properties of a class at runtime. Reflection allows you to obtain metadata about types, methods, properties, fields, etc., without knowing them at compile-time.
Read moreHow to dynamically add button and click event in C#
By Tan Lee Published on May 21, 2024 17.86K
In C#, you can dynamically add a button click event handler by creating a method that will handle the click event and then assigning this method to the button's Click event at runtime.
Read moreHow to read .csv file in C#
By Tan Lee Published on Jul 16, 2024 30.92K
To read a CSV file into a DataTable and display it in a DataGridView in a C# Windows Forms application, you can follow these steps.
Read moreHow to copy data to clipboard in C#
By Tan Lee Published on Dec 05, 2024 1.13K
To copy data to the clipboard in C#, you can use the Clipboard class from the System.Windows.Forms or System.Windows namespaces.
Read moreHow to Insert Update Delete View and Search data from SQL Server in C#
By Tan Lee Published on Jun 01, 2017 13.34K
How to Insert Update Delete View and Search data from SQL Server in C#
Read moreHow to get the status code using HttpClient in C#
By Tan Lee Published on Jan 21, 2025 751
When working with HttpClient in C#, it's important to handle the response status codes to ensure that your application behaves as expected.
Read moreReading Emails Using IMAP and MailSystem.NET in C#
By Tan Lee Published on Jan 15, 2025 843
In this article, we will explore how to use C# along with the MailSystem.NET library to read emails from any IMAP-enabled mail server, including Gmail.
Read moreHow to get the index of an element in C# LINQ
By Tan Lee Published on Oct 29, 2024 625
In C#, you can use LINQ to find the index of an element in a list by utilizing the Select method.
Read moreHow to Create a Geo Chart using LiveCharts in C#
By Tan Lee Published on Jun 25, 2024 10.81K
Creating a Geo Chart (GeoHeatMap) using LiveCharts in a C# Windows Forms Application involves a few steps to set up the environment and then configure the chart.
Read moreHow to Convert WebP to JPEG in C#
By Tan Lee Published on Jan 10, 2025 582
WebP is a modern image format developed by Google, offering superior compression and quality compared to older formats like JPEG and PNG.
Read moreHow to supply IOptions in ASP.NET Core
By Tan Lee Published on Feb 04, 2025 213
The options pattern in C# allows you to inject settings into a registered service through dependency injection. If your code uses this pattern, you will need to provide an IOptions
How to Turn Off Startup Logging in ASP.NET Core
By Tan Lee Published on Feb 04, 2025 310
When you launch an ASP.NET Core web application, you might notice several startup log messages in the console.
Read moreHow to use Dictionary with tuples in C#
By Tan Lee Published on Dec 20, 2024 571
You can use dictionaries with tuples as either keys or values in C#.
Read moreHow to Read Request Headers in ASP.NET Core
By Tan Lee Published on Feb 03, 2025 337
ASP.NET Core MVC is a lightweight, open-source framework built on top of the ASP.NET Core 5 runtime. It provides support for handling request and response headers, which are collections of key-value pairs exchanged between the server and the client.
Read moreHow to Upload Image to Server in C#
By Tan Lee Published on Jul 17, 2024 14.27K
To upload an image to a web server in a C# Windows Forms application, you can use the HttpClient class or RestSharp to send a POST request with the image data as a multipart form data.
Read moreHow to Add a Custom Prerequisites to Visual Studio Setup Project
By Tan Lee Published on Jul 13, 2024 19.8K
To add the Microsoft Access Database Engine as a prerequisite in a Visual Studio Setup Project, follow these steps.
Read moreHow to Parse a Comma-Separated String from App.config in C#
By Tan Lee Published on Dec 20, 2024 500
In this article, I'll walk you through how to parse comma-separated integer values from app.config and load them into a HashSet for efficient lookups.
Read moreHow to fix 'The transaction log for the database is null due to OLDEST_PAGE'
By Tan Lee Published on Feb 16, 2024 628
The error 'The transaction log for the database is null due to 'OLDEST_PAGE' in SQL Server typically indicates a situation where the transaction log is corrupted or there is an issue with the log file structure.
Read moreC# Image Rotation
By Tan Lee Published on Jan 16, 2025 342
In this article, we will continue our exploration of image editing techniques in C# by focusing on a simple method to rotate an image, similar to how it's done in Adobe Photoshop.
Read moreHow to Use the New Lock Object in C#
By Tan Lee Published on Jan 15, 2025 386
C# has supported thread synchronization with the `lock` keyword since its early versions, ensuring that only one thread executes a block of code at a time.
Read moreHow to fix InvalidOperationException: No service for type 'Microsoft.AspNetCore.Identity.UserManager'
By Tan Lee Published on May 11, 2024 3.87K
To resolve the error 'InvalidOperationException: No service for type 'Microsoft.AspNetCore.Identity.UserManager[Microsoft.AspNetCore.Identity.IdentityUser]' has been registered,' follow these steps when customizing ASP.NET Core Identity.
Read moreSystem.InvalidOperationException: Unable to resolve service for type while attempting to activate
By Tan Lee Published on Jan 11, 2025 2.44K
The error System.InvalidOperationException: Unable to resolve service for type while attempting to activate typically occurs in .NET applications when the dependency injection (DI) container is unable to resolve or instantiate a service that is being requested.
Read moreBatch JSON Arrays with LINQ Chunk Method
By Tan Lee Published on Jan 09, 2025 168
By utilizing the LINQ Chunk method, you can transform a one-dimensional array into a two-dimensional array (batches).
Read moreConverting One JSON to Another in C# Using Newtonsoft and Dynamic ExpandoObject
By Tan Lee Published on Jan 09, 2025 246
The task of transforming one JSON format into another is quite common.
Read moreHow to use HttpModules in ASP.NET
By Tan Lee Published on Jan 07, 2025 188
HTTP modules in ASP.NET are components that intercept incoming requests and inject pre-processing logic into the request processing pipeline.
Read moreHow to measure the execution time using PostSharp
By Tan Lee Published on Jan 07, 2025 254
PostSharp's AOP (Aspect-Oriented Programming) features allow you to profile methods and identify slow-running ones in your application.
Read moreUsing cookies in ASP.NET Core
By Tan Lee Published on Jan 07, 2025 309
A cookie is a small data file stored on a user's computer to hold information about the user. While most browsers store cookies as individual files, Firefox stores them together in one file.
Read moreHow to use inversion of control in C#
By Tan Lee Published on Jan 03, 2025 268
IoC and dependency injection (DI) both aim to reduce dependencies between components, enhancing testability and maintainability.
Read more