How To

How to Cancel an HttpClient Request in C#
1/21/2025 8:47:28 AM  22

In C#, you can achieve this by using the CancellationToken with the HttpClient class.

How to get the status code using HttpClient in C#
1/21/2025 8:41:32 AM  29

When working with HttpClient in C#, it's important to handle the response status codes to ensure that your application behaves as expected.

C# Async/await with a Func delegate
1/21/2025 8:31:17 AM  14

To make a Func delegate awaitable, you need to return a Task from the delegate.

C# Async Main
1/21/2025 8:22:57 AM  11

The Async Main feature, introduced in C# 7.1, allows you to make the Main() method asynchronous.

The referenced component could not be found
1/21/2025 8:06:11 AM  29

When opening a C# project in Visual Studio, you may encounter a frustrating error where none of the references load correctly.

How to make concurrent requests with HttpClient in C#
1/21/2025 8:01:10 AM  26

The HttpClient class is designed for making concurrent requests. It is thread-safe, meaning you can send multiple requests at the same time, whether from a single thread or multiple threads.

Fixing the Sync over Async Antipattern in C#
1/21/2025 7:51:41 AM  14

One common mistake developers make is the Sync over Async antipattern, which occurs when blocking waits are used in asynchronous methods instead of awaiting them properly.

C# Add to a Dictionary
1/21/2025 7:45:11 AM  21

The simplest way to add a key-value pair to a dictionary is by using Dictionary.Add().

How to Modify app.config at Runtime
1/21/2025 7:43:22 AM  26

When trying to modify the app.config at runtime, it's essential to handle it correctly to avoid errors like:

SqlTypeException: SqlDateTime overflow
1/21/2025 7:35:18 AM  23

The System.Data.SqlTypes.SqlTypeException: ‘SqlDateTime overflow.' error occurs when you try to insert a DateTime value that is outside the valid range for SQL Server's datetime data type.

SqlTypeException: 'Overflow error converting to data type int.'
1/21/2025 7:30:50 AM  35

The System.Data.SqlTypes.SqlTypeException: 'Overflow error converting to data type int.' occurs when you try to insert a value that is outside the valid range of the SQL int data type, which is between -2,147,483,648 and 2,147,483,647.

C# Filter a dictionary
1/21/2025 7:16:22 AM  7

The simplest way to filter a dictionary is by using the LINQ Where() and ToDictionary() methods.