docs(csharp): require null-safe code

This commit is contained in:
Julian lechner committed 2026-09-30 08:39:23 +02:00
1 parent 36f58626d8
commit 097cec41c2
1 file changed
+1
@@ -3,6 +3,7 @@
Apply these rules when designing type contracts, choosing collection shapes, or exposing data through APIs.
* Prefer strongly typed models over `object`, `dynamic`, loosely typed dictionaries, or string-based contracts.
* Write null-safe code: enable nullable reference types where supported, model nullability accurately, and check nullable values before dereferencing them. Avoid null-forgiving operators unless a nearby invariant proves the value cannot be null.
* Prefer concrete collection types for internal parameters, properties, and local APIs when the contract does not need abstraction.
* Expose collection interfaces such as `IReadOnlyList<T>`, `IEnumerable<T>`, `IDictionary<TKey, TValue>`, or `ICollection<T>` only when their capability is part of an intentional boundary or public contract.
* Choose collection types based on lookup, ordering, mutation, and iteration needs. Pre-size collections only when expected capacity is known and material.