C# Marking Deprecated Code As Obsolete
If a certain piece of code is no longer relevant or needed, or if it’s no longer maintained, you can mark it as obsolete. Use the [Obsolete] tag to mark the code. You can mark a function:...
View ArticleC# Add UserAgent to Application Insights Request Telemetry using a Middleware
This is probable rather specific, but I have this API endpoint, and in my Application Insights I need the UserAgent whenever I log a Request. Custom Properties of a Request Telemetry in Application...
View ArticleC# Sort List of Dynamic Objects
The dynamic type in C# is a static type that bypasses static type checking. This makes it possible for you to work with objects like they were strongly typed, but without having to create named model...
View ArticleC# Sort JArray NewtonSoft.Json
OK, just to burst your bubble: You cannot sort JArray. But if your JArray is just a list of numbers, or letters, you can convert the JArray into a list, sort that, and put it back into your JArray. In...
View ArticleC# Lowercase all JSON attributes in your API responses
When creating an API in C#, you can control how your JSON response should be formatted. The classic way is to us the JsonPropertyName attribute and define the output in a per-field manner: using...
View ArticleAzure Functions: No job functions found. Try making your job classes and...
This error message might occur when working with Azure Functions in Isolated Mode: No job functions found. Try making your job classes and methods public. If you’re using binding extensions (e.g....
View ArticleConvert JSON Arrays into batches of JSON Arrays using the LINQ Chunk method
This is one way of converting a JSON array of any JSON objects into batches. This function uses the LINQ Chunk method to convert a 1 dimensional array input into a 2 dimensional array output: Example...
View ArticleC# POST x-www-form-urlencoded using HttpClient
To POST x-www-form-urlencoded data in C# using the HttpClient, you can do the following: using System.Net.Http; private static HttpClient _httpClient = new HttpClient(); public async...
View ArticleConnect to Salesforce Data Cloud Ingestion API using C# and HttpClient
As a C# developer, to properly connect to Salesforce Data Cloud, you need to do 3 steps: Request an Access Token using the credentials provided for you. Exchange the Access Token for a Data Cloud...
View ArticleAzure Table Storage Create Read Update Delete entities – a base class...
Azure Table Storage is a simple way of storing structured data with no relations (also known as structured NoSQL data) in a storage account. Think of it as an spreadsheet with 2 mandatory keys (a...
View Article