Search

How to use log4net for logging in C#
By Tan Lee Published on Jun 07, 2024 15.05K

Using log4net in C# Windows Forms applications is a great way to incorporate logging functionality into your application for debugging and error tracking purposes.

Read more
How to create a custom exception in C#
By Tan Lee Published on Dec 24, 2024 297

Creating a custom exception is straightforward and can help make your application’s error-handling more precise and informative.

Read more
How to make a file read-only in C#
By Tan Lee Published on Dec 24, 2024 466

There are two primary methods to make a file read-only: using the FileInfo.IsReadOnly property or the File.SetAttributes() method combined with bitwise operations.

Read more
How to get current assembly in C#
By Tan Lee Published on Nov 28, 2024 380

To get the current assembly name in C#, you can use the GetExecutingAssembly() method from the System.Reflection.Assembly class.

Read more
How to use BlockingCollection in C#
By Tan Lee Published on Dec 21, 2024 449

The BlockingCollection class in .NET is a powerful tool designed to simplify working with blocking, concurrent queues.

Read more
How to get CheckedListBox selected values in C#
By Tan Lee Published on Dec 21, 2024 715

In Windows Forms (WinForms), the CheckedListBox control provides a powerful way to display a list of items with checkboxes, allowing users to select multiple options simultaneously.

Read more
Calculating the Distance Between Two Coordinates in C#
By Tan Lee Published on Dec 21, 2024 691

Imagine you’re standing in the middle of Millennium Park in Chicago, looking for a cup of coffee.

Read more
Could Not Find an Implementation of the Query Pattern
By Tan Lee Published on Dec 21, 2024 132

When working with LINQ in C#, developers often encounter a common compiler error that can be both frustrating and confusing.

Read more
Objects added to a BindingSource’s list must all be of the same type
By Tan Lee Published on Dec 21, 2024 428

When working with data binding in C#, one common scenario is binding a list of objects to a user interface control (like a DataGridView, ComboBox, or ListBox).

Read more
How to Use regex capturing groups to extract data in C#
By Tan Lee Published on Dec 20, 2024 415

In regex, capturing groups allow you to extract and save portions of text for later use. These groups can either be unnamed and referenced by index, or they can be named for easier reference.

Read more