.NET Core equivalent to Thread.Abort
Use thread.Interrupt(); instead of Abort() method.
Use thread.Interrupt(); instead of Abort() method.
not a bug, a feature The issue that I’ve opened has been closed, but they gave a very good explanation. Now… In .NET 5.0 they began using on Windows (on Linux it was already present) a new library for comparing strings, the ICU library. It is the official library of the Unicode Consortium, so it … Read more
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
Short version Can your data type be a value type? Go with struct. No? Does your type describe a value-like, preferably immutable state? Go with record. Use class otherwise. So… Yes, use records for your DTOs if it is one way flow. Yes, immutable request bindings are an ideal user case for a record Yes, … Read more
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
As stated in the new C# 9 features post, The one big limitation today is that the properties have to be mutable for object initializers to work: They function by first calling the object’s constructor (the default, parameterless one in this case) and then assigning to the property setters. However, value types with readonly modifiers … Read more
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
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