How To

Connecting to Multiple Databases in C# using DataContext
By Tan Lee Published on Jan 09, 2025 463

As your application grows, you might find the need to connect to two or more databases.

Marking Deprecated Code as Obsolete in C#
By Tan Lee Published on Jan 09, 2025 301

If certain code is no longer needed, outdated, or no longer maintained, you can mark it as obsolete.

How to Add User-Agent to Application Insights Telemetry in C# Using Middleware
By Tan Lee Published on Jan 09, 2025 378

To achieve this, we’ll implement a custom middleware.

How to Sort a List of Dynamic Objects in C#
By Tan Lee Published on Jan 09, 2025 337

The dynamic type in C# allows you to work with objects without specifying their exact type ahead of time.

Sorting JArray in C# with Newtonsoft.Json
By Tan Lee Published on Jan 09, 2025 247

Although you can't directly sort a JArray in C#, you can work around this limitation.

Lowercase JSON Attributes in C# API Responses
By Tan Lee Published on Jan 09, 2025 283

When developing an API in C#, you can customize how the JSON response is formatted.

Batch JSON Arrays with LINQ Chunk Method
By Tan Lee Published on Jan 09, 2025 155

By utilizing the LINQ Chunk method, you can transform a one-dimensional array into a two-dimensional array (batches).

Implementing HTTP Timeout Retries with Polly and IHttpClientBuilder
By Tan Lee Published on Jan 09, 2025 510

Polly's retry functionality combined with IHttpClientBuilder provides an elegant solution to configure retry logic at the application startup.

Creating Dynamic Arrays and Lists with Dynamic and ExpandoObject in C#
By Tan Lee Published on Jan 09, 2025 535

In this example, we demonstrate creating a dynamic list where the number of objects is not known in advance.

Converting One JSON to Another in C# Using Newtonsoft and Dynamic ExpandoObject
By Tan Lee Published on Jan 09, 2025 225

The task of transforming one JSON format into another is quite common.

Convert array of objects into a DataTable in C#
By Tan Lee Published on Jan 09, 2025 290

This extension method allows you to easily convert an array of objects into a DataTable, which can be used for SQL insert operations.

‘SHA256Managed’ is obsolete: ‘Derived cryptographic types are obsolete
By Tan Lee Published on Jan 09, 2025 324

Warning SYSLIB0021 'SHA512Managed' is obsolete: 'Derived cryptographic types are obsolete. Use the Create method on the base type instead.'