How To

How to group by multiple columns using LINQ
By Tan Lee Published on Dec 10, 2024 497

In LINQ, you can group by multiple columns using the group by clause in combination with anonymous types.

How to search for files in folder in C#
By Tan Lee Published on Nov 21, 2024 713

To search for files in a folder in C#, you can use the Directory.GetFiles method from the System.IO namespace.

How to hide “Showing 1 of N Entries” with jQuery datatables
By Tan Lee Published on May 28, 2024 2.86K

To hide the "Showing # to # of # entries" message in jQuery DataTables, you can use CSS to hide the element containing this information.

How to kill process by name in C#
By Tan Lee Published on Oct 10, 2024 1K

To kill a process by name in C#, you can use the System.Diagnostics namespace, which provides the Process class.

How to convert a dictionary to a list in C#
By Tan Lee Published on Dec 20, 2024 3.13K

In C#, dictionaries are commonly used to store key-value pairs, but sometimes, you might want to work with a list of these pairs instead of a dictionary.

C# Convert a list to a dictionary
By Tan Lee Published on Jan 21, 2025 624

The easiest way to convert a list into a dictionary is by using the LINQ ToDictionary() method.

How to set json serializer settings in ASP.NET Core
By Tan Lee Published on Dec 27, 2024 758

In ASP.NET Core, you can configure JSON serializer settings for your application in a few different ways, typically through the Startup.cs or Program.cs file.

Serialize a tuple to JSON in C#
By Tan Lee Published on Feb 05, 2025 914

When you serialize a tuple to JSON, the underlying ValueTuple field names, Item1 and Item2, are used. This is true even if you are using a named tuple. The field names you specify in the tuple declaration won't be reflected in the JSON.

How to check if a nullable bool is true in C#
By Tan Lee Published on Dec 24, 2024 777

In C#, nullable types allow you to represent data that can be absent or undefined, in addition to its usual valid values.

How to get application folder path in C#
By Tan Lee Published on Dec 05, 2024 1.57K

To get the application folder path in a .NET application, you can use the Server.MapPath() method in ASP.NET or AppDomain.CurrentDomain.BaseDirectory for other types of applications.

How to get the current working folder in C#
By Tan Lee Published on Nov 13, 2024 1.1K

In C#, you can get the current working directory using the Directory.GetCurrentDirectory() method, which is part of the System.IO namespace.

Using LINQ to remove elements from a List<T>
By Tan Lee Published on Dec 10, 2024 568

In LINQ, you cannot directly remove elements from a List<T> because LINQ itself is designed primarily for querying and transforming data, not for modifying collections.