
20 Naming Conventions in C#:
- Classes, Methods, Properties, Enums: Pascal Case (
CustomerOrder,ProcessOrder) - Local Variables, Method Parameters: camelCase (
orderNumber,customerName) - Private Fields: camelCase with Underscore (
_customerName) - Constants: ALL_CAPS (
PI,MAX_LENGTH) - Interfaces: Pascal Case with "I" Prefix (
IOrderProcessor) - Enums: Pascal Case for names and members (
OrderStatus,Pending) - Namespace Names: Pascal Case (
CompanyName.ProjectName) - File Names: Match class or interface names (
CustomerOrder.cs) - Event Names: Pascal Case with verbs (
OrderProcessed) - Boolean Variables: Prefixes like "is", "has", "can" (
IsProcessed,HasShipped) - Method Parameters: camelCase (
orderNumber,orderDate) - Static Fields: Pascal Case (
ConnectionString) - Readonly Fields: camelCase with underscore (
_employeeId) - Attributes: Pascal Case with "Attribute" suffix (
AuthorAttribute) - Async Methods: Pascal Case with "Async" suffix (
ProcessOrderAsync) - Collections and Arrays: Plural nouns (
Products,CustomerAddresses) - Delegate Names: Pascal Case with "Handler" suffix (
OrderProcessedHandler) - Extension Methods: Pascal Case (
IsNullOrEmpty) - Properties with Backing Fields: Pascal Case for properties, camelCase with underscore for backing fields (
Name,_name) - Constructor/Method Parameters: Descriptive camelCase (
customerName,newName)
These 20 conventions ensure your C# code is clear, professional, and maintainable across different projects.


