Timeline for How do you name your private variables in C#?
Current License: CC BY-SA 2.5
5 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Dec 18, 2012 at 0:33 | comment | added | Big McLargeHuge | I have to disagree with ChaosPandoin. To me, both implementations of Method() are easy to read. As soon as I see the age variable (or _age) and notice that it's not declared in the method, I realize it must be declared elsewhere in the class. The this qualifier is awful but at least it's confined to the constructor method. | |
| Sep 12, 2010 at 1:22 | comment | added | Evan Plaice | I say, use 1 for private variables, use 4 for private variables used in properties. | |
| Sep 9, 2010 at 17:47 | comment | added | Jeremy Wiebe | I used to swear by your first example, but after trying option #4 for a while I much prefer using underscores as a prefix for private fields. | |
| Sep 9, 2010 at 16:44 | history | edited | ChaosPandion | CC BY-SA 2.5 | added 51 characters in body |
| Sep 9, 2010 at 16:39 | history | answered | ChaosPandion | CC BY-SA 2.5 |