How To

How to Parser a CSV file in C#
By Tan Lee Published on Mar 06, 2025 399

Parsing a CSV file in C# can be done in a few different ways depending on your needs.

How to read configuration from appsettings.json in C#
By Tan Lee Published on Mar 06, 2025 669

The appsettings.json file is an efficient way to store and retrieve your application's configuration. It's a JSON file, which makes it much easier to work with than the older XML-based app.config used in earlier versions of .NET.

How to deconstruct an object in C#
By Tan Lee Published on Mar 06, 2025 237

Deconstructing an object means assigning its properties to several variables in a single line of code using deconstruction assignment syntax (also known as destructuring or unpacking).

Handling CSV Files Without a Header Row Using CsvHelper
By Tan Lee Published on Mar 06, 2025 405

When working with CSV files that lack a header row, CsvHelper requires configuration to map data by field position rather than by header name. In this guide, I will show you how to set it up properly, as well as an alternative manual parsing approach for such cases.

CSVHelper: Header with name not found
By Tan Lee Published on Mar 06, 2025 553

When your CSV file’s header names do not match the property names in your class, CsvHelper will throw an error.

How to Convert a Comma-Separated String into a List of Integers in C#
By Tan Lee Published on Mar 06, 2025 412

Let’s consider a scenario where you have a comma-separated string of numbers, such as "5,10,15", and you want to convert it into a list of integers, like [5, 10, 15].

How to send synchronous requests with HttpClient in C#
By Tan Lee Published on Mar 06, 2025 396

In .NET 5 and above, the HttpClient Sync API methods Send() and ReadAsStream() provide a way to send HTTP requests synchronously, allowing you to avoid the complexities of async code (like sync-over-async)

How to disable ModelStateInvalidFilter in ASP.NET Core
By Tan Lee Published on Feb 04, 2025 732

In ASP.NET Core, ModelStateInvalidFilter is a built-in filter that automatically returns a 400 Bad Request response when the ModelState is invalid.

Mastering Performance Tuning and Best Practices in Entity Framework Core 9
By Tan Lee Published on Mar 05, 2025 204

Entity Framework (EF) is the most widely used object-relational mapper (ORM) for .NET developers, providing an abstraction layer over database interactions that enhances developer productivity.

How to upload file using AngularJS
By Tan Lee Published on Feb 16, 2024 465

To upload a file in AngularJS with an ASP.NET Web API, you need to set up both the AngularJS frontend and the ASP.NET Web API backend to handle file uploads.

How to fix 'NonComVisibleBaseClass was detected'
By Tan Lee Published on Feb 15, 2024 912

The error "NonComVisibleBaseClass was detected" in Visual Studio typically occurs when you are working with COM interop in .NET, and your class inherits from a base class that isn't COM-visible.

How to create a simple progress bars in Python
By Tan Lee Published on Feb 12, 2024 482

To create a simple progress bar in Python using the tqdm library, you can follow these steps: