Use this solution for uploading files to any REST endpoint using C#. Unlike the WebClient.UploadFile method from the .NET framework, this technique allows you to pass custom parameters that may be required by your API.
C#
Delete Folder With Read-Only Contents Using C#
To delete a folder and its contents using C# is not necessarily as easy and straightforward as you might think. It becomes tricky when one or more files are marked as read-only. Here’s a recursive helper method.
Iterating List Items In Batches With C# [Chunking]
There are lots of programming situations where it is necessary to break up a large amount of work into smaller more manageable pieces or chunks. The technique is known as “Chunking” and is frequently used when a huge list needs to be iterated in batches of say, 100 items at a time.
Get Network Path Of Mapped Drive With C#
There are a number of resources out there that attempt to explain how to get the network path of a mapped drive letter or path. However, I found most of them to be incomplete and/or full of errors. Two potential solutions are discussed here. One uses PInvoke the other is a pure .NET method.
Add Row Numbers To DataGridView in C#
The DataGridView is the control that is mostly used for displaying the contents of lists, tables etc. However, the built-in version of this control doesn’t allow for adding row numbers/count via its properties. This feature is often required because it is difficult to keep track of the records in a table with 1000 rows if row numbers are not displayed.
Prevent Multiple Instances of Same Application in C#
By default, .NET windows forms applications generally allow multiple instances of the same application to be started on the same machine. However, if two or more threads attempt to access a shared resource such as shared memory at the same time, concurrency issues may occur. And in a production environment, this might result in data inconsistency or inaccuracy.