How To

Dictionary with multiple values per key in C#
By Tan Lee Published on Dec 20, 2024 3.72K

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.

How to delete a Windows service in PowerShell
By Tan Lee Published on Nov 05, 2024 765

To delete a Windows service using PowerShell, you'll need to stop the service and then remove it from the system.

How to use reflection to get properties in C#
By Tan Lee Published on Feb 04, 2025 816

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.

How to copy data to clipboard in C#
By Tan Lee Published on Dec 05, 2024 1.24K

To copy data to the clipboard in C#, you can use the Clipboard class from the System.Windows.Forms or System.Windows namespaces.

HttpClient Retry with .NET Core, Polly, and IHttpClientFactory
By Tan Lee Published on Jan 09, 2025 514

Many HTTP errors are temporary and caused by issues such as server overload, network timeouts, or transient glitches.

How to get data attribute value for selected option
By Tan Lee Published on May 31, 2024 3.47K

To get the value of a data attribute for the selected option in a dropdown using jQuery, you can use the data() method along with the :selected selector.

How to get the status code using HttpClient in C#
By Tan Lee Published on Jan 21, 2025 862

When working with HttpClient in C#, it's important to handle the response status codes to ensure that your application behaves as expected.

Reading Emails Using IMAP and MailSystem.NET in C#
By Tan Lee Published on Jan 15, 2025 940

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.

How to get the index of an element in C# LINQ
By Tan Lee Published on Oct 29, 2024 669

In C#, you can use LINQ to find the index of an element in a list by utilizing the Select method.

How to update UI from another thread in C#
By Tan Lee Published on Dec 21, 2024 2.67K

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.

How to Convert varchar to uniqueidentifier in SQL Server
By Tan Lee Published on May 16, 2024 3.28K

To convert a varchar to a uniqueidentifier in SQL Server, you can use the CAST or CONVERT function.

Serialize and Deserialize a Multidimensional Array in JSON using C#
By Tan Lee Published on Dec 25, 2024 1.19K

By default, System.Text.Json does not support serializing or deserializing multidimensional arrays.