How To

Async SSE endpoint in ASP.NET Core
By Tan Lee Published on Mar 04, 2025 163

Server-Sent Events (SSE) allow a client to receive real-time updates from the server. Unlike WebSockets, SSE is a simpler alternative that works over HTTP and is ideal for one-way communication, such as notifications.

Cannot convert null to type parameter 'T'
By Tan Lee Published on Dec 24, 2024 259

When working with generic methods in C#, you may encounter the following compiler error while trying to return null:

How to use Razor View Engine in ASP.NET Core
By Tan Lee Published on Feb 03, 2025 318

The ASPX View Engine, a legacy feature in ASP.NET MVC, was part of the framework from its early days.

How to Convert DateTime to Unix Timestamp in C#
By Tan Lee Published on Jul 11, 2024 1.99K

In .NET, you can easily convert DateTime object back to a Unix timestamp.

How to format number with commas and decimal in Javascript
By Tan Lee Published on Feb 16, 2024 419

In JavaScript, you can format numbers with commas and decimal points using various methods.

How to prevent target blank links from opening in a new window in Cefsharp
By Tan Lee Published on Jul 03, 2024 676

In CefSharp, which is a .NET wrapper for the Chromium Embedded Framework (CEF), you can control how links with target="_blank" are handled.

How to fix System.InvalidOperationException: Scheme already exists: Identity.Application
By Tan Lee Published on Jun 17, 2024 2.31K

The error message System.InvalidOperationException: Scheme already exists: Identity.Application typically occurs when you're trying to add Identity to your ASP.NET Core project, but the scheme "Identity.Application" is already registered in the authentication options.

How to handle nulls with SqlDataReader in C#
By Tan Lee Published on Dec 24, 2024 1.56K

The SqlDataReader object, which is used to read data from a SQL Server database, returns DBNull when it encounters a NULL in a column.

Update records with Dapper in C#
By Tan Lee Published on Jan 18, 2025 599

You can update records in a database using Dapper by leveraging the Execute() method along with an UPDATE statement.

How to hide the Console Application in C#
By Tan Lee Published on Jun 08, 2024 10.4K

To hide a console application in C#, you can utilize the ShowWindow function from the user32.dll library to hide the console window programmatically.

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

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 547

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