Skip to content

Instantly share code, notes, and snippets.

View maxreb's full-sized avatar
🌍

Max Reble maxreb

🌍
  • hse-electronics GmbH
  • Kiel, Germany
View GitHub Profile
@maxreb
maxreb / JsonSerializerExtensions.cs
Created November 29, 2022 15:29
Benchmark PopulateObject
using System.Diagnostics;
using System.Runtime.CompilerServices;
using System.Text.Json;
using System.Text.Json.Serialization.Metadata;
public static class JsonSerializerExt
{
// Dynamically attach a JsonSerializerOptions copy that is configured using PopulateTypeInfoResolver
private readonly static ConditionalWeakTable<JsonSerializerOptions, JsonSerializerOptions> s_populateMap = new();