How To

How to Configure HttpClient connection keep-alive in C#
3/11/2025 7:43:08 AM  202

When using a single instance of SqlConnection to interact with a database, the connection is pooled, meaning it can be reused for subsequent requests to improve performance.

Performance Benefits of Reusing Connections with HttpClient
3/11/2025 7:36:10 AM  88

To demonstrate the performance gains of keeping a database connection open and reusing it across multiple queries, I’ll perform multiple database queries to the same database.

How to add request headers when using HttpClient in C#
3/11/2025 7:31:20 AM  167

When using HttpClient to send requests in C#, there are two primary ways to add headers:

How to Delete records with Dapper in C#
3/10/2025 9:58:53 AM  150

In C#, you can use Dapper to delete records from a database by executing a DELETE statement with the Execute() method, passing in the record identifier as a parameter.

How to Execute a SELECT query with Dapper in C#
3/10/2025 9:55:34 AM  172

You can query a database in C# using Dapper by executing a SELECT query with the Query() method, specifying the type to map the results to, and optionally adding parameters.

How to Get inserted identity value with Dapper in C#
3/10/2025 9:49:43 AM  179

When inserting a record into a table that has an identity column, the database automatically generates a value for that column. To retrieve the identity value after the insert, you can use the OUTPUT INSERTED.<identity column name> clause in your SQL query.

How to add class to tr using jQuery datatable
3/10/2025 9:37:51 AM  1.8K

To add a class name to a DataTable using jQuery, you can use the className option when initializing the DataTable or you can add classes dynamically after the table has been initialized.

Dictionary with multiple values per key in C#
3/10/2025 9:36:39 AM  2.32K

Each dictionary key in C# maps to exactly one value. However, if you need to store multiple values for a single key, you can use a dictionary of lists.

How to delete a Windows service in PowerShell
3/10/2025 9:34:05 AM  558

To delete a Windows service using PowerShell, you'll need to stop the service and then remove it from the system.

How to use reflection to get properties in C#
3/10/2025 9:32:30 AM  458

In C#, you can use reflection to inspect the properties of a class at runtime. Reflection allows you to obtain metadata about types, methods, properties, fields, etc., without knowing them at compile-time.

How to copy data to clipboard in C#
3/10/2025 9:29:23 AM  863

To copy data to the clipboard in C#, you can use the Clipboard class from the System.Windows.Forms or System.Windows namespaces.

HttpClient Retry with .NET Core, Polly, and IHttpClientFactory
3/10/2025 9:28:12 AM  371

Many HTTP errors are temporary and caused by issues such as server overload, network timeouts, or transient glitches.