Updated C# and .NET docs supplement (markdown)

James Groom 2023-12-28 10:20:44 +10:00
parent 65285c3bbb
commit 1081c3ddb0
1 changed files with 8 additions and 1 deletions

@ -31,7 +31,7 @@ You can only have 1 `default` branch, but `case _ when ...:` doesn't work. Howev
## MSBuild `Condition` placement
On (older versions of?) VS, `Condition` is ignored if placed on a property. Create a new `<PropertyGroup/>`.
On (older versions of?) VS, `Condition` is ignored if placed on a property/item. Create a new `<PropertyGroup/>`.
## MSBuild property evaluation execution order
@ -49,6 +49,13 @@ Use `MSBuildProjectDirectory`. Note that the latter doesn't include a trailing s
.NET will happily include NUL (`(char) 0`) in a string if you use `String..ctor(char[])`.
WinForms' `Label.Text` stops reading at the first NUL for measurement/rendering, at least under Mono.
## Preprocessor TFM constants and .NET Standard
The table [here](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/preprocessor-directives#conditional-compilation) is good for reference, but mind the note hidden at the bottom:
> The `NETSTANDARD<x>_<y>_OR_GREATER` symbols are only defined for .NET Standard targets, and not for targets that implement .NET Standard [...]
That is, you must use `#if !(NETSTANDARD2_1_OR_GREATER || NETCOREAPP2_1_OR_GREATER)` and not just `#if !NETSTANDARD2_1_OR_GREATER`.
## `String.GetHashCode` stability
The `GetHashCode` implementation for strings does not reflect the string's contents, and as such, the hash not stable between program instances.