C# development standards and best practices. Use when writing C# code, reviewing C# changes, or implementing C# features...
.editorconfig| Element | Convention | Example |
|---|---|---|
| Components/Methods/Public members | PascalCase |
UserService, GetUserById |
| Private fields/Local variables | camelCase |
userId, isValid |
| Interfaces | I prefix + PascalCase |
IUserService |
if, for, while, foreach, using, try, etc.)nameof instead of string literals when referring to member names<example> and <code> documentation in comments when applicablenull at entry pointsis null or is not null instead of == null or != nulldotnet publish --os linux --arch x64 -p:PublishProfile=DefaultContainer