Exact duplicate of "Naming convention for params of ctors and setters"
I don't use prefix while naming internal variables of a class (I know some do but I am not starting "why do you..." debate). I just prefer it that way. The problem is that sometimes same parameters are passed in contructor and I end up being confused how to name them. For example:
public class SampleClass { private int classId; private string className; public SampleClass (int XclassIdX, string XclassNameX) { classId = XclassIdX; className = XclassNameX; } }
How to name XclassIdX and XclassNameX?
One thing that can probably be done is:
public class SampleClass { private int classId; private string className; public SampleClass (int classId, string className) { this.classId = classId; this.className = className; } }
Just not sure whether this is a good idea or there are other more elgant ways?