csharp
C# Conventions
For any BCL or NuGet API surface not pinned down here, resolve signatures with the documentation tools rather than memory - never by grepping the NuGet cache or decompiled sources.
C# style, structure, and runtime conventions in one place: how code is shaped (naming, layout, syntax) and how it behaves (async, I/O, exceptions, logging, DI). Style is enforced by .editorconfig (Allman braces through the formatting rule IDE0055, file-scoped namespaces through IDE0161) and EnforceCodeStyleInBuild=true.
Formatting, naming, and language-feature style is authoritative in references/csharp-style.md (with the full canonical .editorconfig); the .NET Framework 4.8 delta (the C# 7.3 ceiling, polyfills, the SynchronizationContext async caveat) is references/net-framework-48.md. This file keeps the house rules those do not cover, and where it overlaps them, the style docs win. Above all of these, a project's own .editorconfig and its <docs-path>/preferences/PROJECT-CODE-PREFERENCES.md are higher priority: where a project diverges from these general conventions, follow the project. The user's own preferences docs there rank higher still: where an entry and this skill disagree, ask the user which wins, the entry's side marked (Recommended).
Floor: .NET 10 / C# 14. .NET 8 / 9 are past support from 2026-11-10 - deltas below the floor are marked. Every rule below assumes at least this target - TimeProvider, UnsafeAccessorAttribute, the static argument throw-helpers, collection expressions / primary constructors, System.Threading.Lock and the field keyword are all in.
When to use
- Before creating or editing any
.csfile - writing, reviewing, or refactoring C#; do not lean on recalled conventions. - The always-load baseline underneath the specialist areas: style and structure plus runtime behavior, with the
per-area deltas in
references/. - Do NOT load it INSTEAD of one: architectural style choices, EF query shaping, ASP.NET request-pipeline work and performance tuning route out through the .NET router where the install has one.