.NET (C#)
Casing Rules
| Element | Convention | Example |
|---|---|---|
| Classes | PascalCase | OrderService, UserRepository |
| Interfaces | PascalCase with I prefix | IPaymentProcessor, IUserRepository |
| Enums | PascalCase | PaymentMethod, OrderStatus |
| Enum members | PascalCase | PaymentMethod.CreditCard |
| Methods | PascalCase | GetUserById, ProcessPayment |
| Properties | PascalCase | FirstName, IsActive |
| Private fields | camelCase with _ prefix | _userRepository, _logger |
| Local variables | camelCase | userCount, isValid |
| Parameters | camelCase | userId, orderRequest |
| Constants | PascalCase | MaxRetryCount, DefaultTimeout |
| Namespaces | PascalCase.Dot.Separated | Acmeco.Retail.Orders.Services |
File Naming
One primary type per file. File name matches the type name.
# Good:
OrderService.cs
IUserRepository.cs
PaymentMethod.cs # enum
# Tests:
OrderServiceTests.cs
UserRepositoryIntegrationTests.cs
Namespace Structure
Namespaces mirror the folder structure:
{Company}.{Org}.{Solution}.{Layer}
Acmeco.Retail.Orders.Services
Acmeco.Retail.Orders.Repositories
Acmeco.Retail.Orders.Models