1

This is a naming convention question.

In C#, someone suggested that variables of type List<T> should be named as listBlah instead of just blah. Similarly for variables of type Dictionary<keyT, valueT>. I think the reason is because we can guess the type of a variable by just looking at its name, without having to find where it is declared.

But when you create an object of a class with name "MyClass", what is some good practice to name the object (after the class' name)?

When you create a variable of primitive types such as int, char, string, double, what is some good practice to name it?

I guess this question is not just for C#, but also for other programming languages.

Tim
  • 5,545

1 Answers1

3

This naming style has fallen out of favour, except in the case of Interfaces, which by convention in c# start with 'I'

Other related exceptions are things like Views, Controllers, ViewModels where the appropriate word is sometimes appended to the class name.

Edit : Oh and 'Async' for async Methods is popular

Ewan
  • 83,178