Names that Speak: The Power of Naming in Clean Coding with C#


When we write code, we communicate first with other developers (including our future selves) and only then with the machine. Choosing names for variables, methods, and classes is one of the most powerful—and underrated—tools for writing clean and readable code.
In this article, we’ll explore best practices for choosing clear and meaningful names in C#.
Name things for what they are
Avoid cryptic abbreviations, mysterious acronyms, or overly generic names. Every name should answer a simple question: "What does this represent?"
❌ Bad example:
var d = DateTime.Now;
✅ Good example:
var currentDate = DateTime.Now;
Other examples:
var x
→var userAge
var lst
→var productList
GetData()
→GetUserDataFromDatabase()
Use PascalCase and camelCase according to C# conventions
C# conventions are simple but essential for keeping code consistent:
Element | Convention | Example |
Classes / Enums | PascalCase | ProductService , UserType |
Methods / Properties | PascalCase | GetAllProducts() , Name |
Local variables | camelCase | userName , orderList |
Parameters | camelCase | CalculateTax(decimal amount) |
Avoid visual noise
Words like Data
, Info
, Helper
, Object
added everywhere make names longer and less meaningful.
❌ Noisy example:
class UserDataHelperObject {}
✅ Clear alternative:
class UserService {}
Be consistent
If you call something UserList
in one place and UsersCollection
in another, it causes confusion. Choose one term and use it consistently.
Consistency beats creativity when naming code.
Avoid comments that could be replaced by better names
The best comment is a well-chosen name.
❌ Code with unnecessary comment:
// Calculates the discount
decimal d = price * 0.1m;
✅ Name that eliminates the need for a comment:
decimal discount = price * 0.1m;
Watch out for misleading names
A wrong name is worse than no name. Don’t name a variable users
if it actually contains orders.
❌ Wrong example:
List<User> users = orderService.GetOrders(); // 😬
✅ Correct name:
List<Order> orders = orderService.GetOrders();
Conclusion
Writing clear names is one of the simplest and most immediate ways to improve code quality. The good news? It doesn’t require libraries, patterns, or special tools—just a bit of care.
In the next article, we’ll talk about functions and methods: how to keep them small, clear, and focused on a single responsibility.
Subscribe to my newsletter
Read articles from Developer Fabio directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Developer Fabio
Developer Fabio
I'm a fullstack developer and my stack is includes .net, angular, reactjs, mondodb and mssql I currently work in a little tourism company, I'm not only a developer but I manage a team and customers. I love learning new things and I like the continuous comparison with other people on ideas.