Skip to content

Instantly share code, notes, and snippets.

@sgorozco
sgorozco / JoinableTaskTools.cs
Last active May 18, 2022 07:07
Helper class to instantiate a JoinableTaskFactory singleton
using Microsoft.VisualStudio.Threading;
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Threading;
namespace JoinableTaskTools
{
/// <summary>
@mrange
mrange / 0_README.md
Last active May 15, 2022 13:39
Dynamic JSON in C#

Dynamic JSON in C#

How to run

  1. Install dotnet: https://dotnet.microsoft.com/en-us/download
  2. Create a folder named for example: CsDymamic
  3. Create file in the folder named: CsDyamic.csproj and copy the content of 1_CsDyamic.csproj into that file
  4. Create file in the folder named: Program.cs and copy the content of 2_Program.cs below into that file
  5. Launch the application in Visual Studio or through the command line dotnet run from the folder CsDymamic
@davidfowl
davidfowl / AUsage.cs
Last active September 17, 2023 10:26
Header propagation HttpClientFactory middleware
public void ConfigureServices(IServiceCollection services)
{
services.AddHttpClient("myclient");
// Global header propagation for any HttpClient that comes from HttpClientFactory
services.AddHeaderPropagation(options =>
{
options.HeaderNames.Add("Correlation-Id");
});
}