Equivalent to UserSettings / ApplicationSettings in WPF for newer .NET versions

You can add the same old good settings file e.g. via the right click on the Properties -> Add -> New Item and search for the “Settings”. The file can be edited in the settings designer and used as in the .net framework projects before (ConfigurationManager, Settings.Default.Upgrade(), Settings.Default.Save, etc. works). Add also the app.config file … Read more

Enable Systemd in WSL 2

Note: See footnote at bottom of this answer for background on this Community Wiki. There are several possible paths to enabling Systemd on WSL2 (but not WSL1). These are summarized here, with more detail provided below. Option 1: Upgrade WSL to the latest application release (if supported by your system) and opt-in to the Systemd … Read more

Equivalent of JObject in System.Text.Json

As of Nov 2021, .NET 6 introduces the System.Text.Json.Nodes namespace which: Provides types for handling an in-memory writeable document object model (DOM) for random access of the JSON elements within a structured view of the data The four new types are JsonArray, JsonObject, JsonNode and JsonValue. The closest type to JObject is JsonObject which offers … Read more

How to use default serialization in a custom System.Text.Json JsonConverter?

As explained in the docs, converters are chosen with the following precedence: [JsonConverter] applied to a property. A converter added to the Converters collection. [JsonConverter] applied to a custom value type or POCO. Each case needs to be dealt with separately. If you have [JsonConverter] applied to a property., then simply calling JsonSerializer.Serialize(writer, person, options); … Read more