How To

How to insert master/details data in EF Code First
By Tan Lee Published on Nov 09, 2024 246

In Entity Framework (EF) Code First, inserting master-detail data involves inserting records into both the "master" and "detail" tables while respecting the relationships between them (such as one-to-many, many-to-one, etc.).

Connection String in Entity Framework 6
By Tan Lee Published on Nov 09, 2024 259

In Entity Framework 6 (EF6), the connection string is typically specified in the App.config or Web.config file of your project.

How to get current date and time from internet in C#
By Tan Lee Published on Nov 09, 2024 902

In C#, you can retrieve the current date and time from the internet by using a time server (also known as an NTP server) to sync with an accurate time source.

How to convert Bytes To Kilobytes in C#
By Tan Lee Published on Nov 09, 2024 358

To convert bytes to kilobytes (KB) in C#, you simply divide the number of bytes by 1024, since 1 kilobyte (KB) is equal to 1024 bytes.

Intersperse implementation in C#
By Tan Lee Published on Nov 09, 2024 237

In this post, I'll demonstrate how to implement an Intersperse method in C# as an extension method on the IEnumerable<T> interface.

How to install a windows service using Windows command prompt
By Tan Lee Published on Nov 09, 2024 299

To install a Windows service using the Command Prompt, you can use the installutil or sc command.

How to add security headers to your ASP.NET Core
By Tan Lee Published on Nov 08, 2024 444

To add security headers to your ASP.NET Core application, you can use middleware that adds the appropriate headers to HTTP responses.

How to download DataTable in Excel format in C#
By Tan Lee Published on Nov 06, 2024 214

To download tabular data such as DataTable data in Excel CSV/TSV format in C#, you can follow these steps.

How to fix 'The conversion of a varchar data type to a datetime data type resulted in an out-of-range value'
By Tan Lee Published on Nov 06, 2024 1.61K

The error you're encountering, "The conversion of a varchar data type to a datetime data type resulted in an out-of-range value," typically occurs when trying to convert a string that doesn't match the expected datetime format for your SQL server's locale or when the string represents an invalid date.

How to convert string array to string with delimiter in C#
By Tan Lee Published on Nov 06, 2024 359

To convert a string array into a single string with a delimiter in C#, you can use the string.Join method.

How to wipe a file completely in C#
By Tan Lee Published on Nov 05, 2024 374

To securely wipe a file in C# according to the HMG IS5 Baseline, you need to follow a procedure that goes beyond simple file deletion.

How to fade in fade out form in C#
By Tan Lee Published on Nov 05, 2024 403

To create a fade-in and fade-out effect for a form in C# Windows Forms, you can manipulate the Opacity property of the form.