C# conventions
- Nullable reference types are enabled globally. Every public API must have explicit nullability (
string?vsstring). - Private fields:
_camelCase. Properties and methods:PascalCase. Locals and parameters:camelCase. - One public type per file; the filename must match the type name exactly.
- Prefer
sealedon concrete classes that are not designed for inheritance. - Use
readonlyon fields that are set only in constructors. - Extension methods live in a static class whose name ends in
Extensions(Extensionsor<Subject>Extensions) in the appropriate package. - No
dynamic. Noobjectas a catch-all return type when generics work. - Functional types (Result, Maybe, Any) use implicit operators for ergonomic construction. Keep this pattern in new types.
- Prefer record types over classes for immutable value objects.
TreatWarningsAsErrors=trueis global, withAnalysisModeAll andEnforceCodeStyleInBuild. Never suppress a warning without understanding why it fires.- XML documentation comments (
///) on public APIs are expected. No inline code comments (//,/* */) that explain code.