Possible Duplicate:
Why should (or shouldn't) I prefix fields with 'm_' in C#?
I am reading CLEAN CODE
there is one paragraph about member prefixed.
THe author suggests not using m_ anymore.
such as:
public class Part{
private String m_dsc;
void setName(String name){
m_dsc - name;
}
}
should be:
public class Part{
String description;
void setDescription(String description){
this.description = description'
}
}
My question is, why we use m_ before?
And, this book is using Java as an example.
Is this suggestion good for c# ? what about c++
Thank you!
The m_ prefix makes it easy to differentiate member variables with local variables or parameters.
This is valid for classes in object oriented languages (so, yes C#, C++, etc.)
Now, with the advances in IDEs, the m_ prefix doesn’t seem to be as useful though (in the case where you’re wondering if a variable is a class member or not, it’s easy and fast to go to definition.)