} Number three – prefixing fields with an m_ This means the this keyword is not required in the constructor to assign the parameter to the field, as parameter and field have different names. The fieldname is the same as with the previous approach, but with a leading underscore. } Number two – prefixing fields with an underscore
To assign a constructor parameter with the same name, you have to use the this keyword like you see it in the code snippet below, because that’s the only way to distinguish the field from the parameter in the constructor, as both have the same name: public class Person Using camelCasing means that the name starts with a lowercase character and it can use uppercase characters in the name to start new words. These developers create fields that are using camelCasing, like the firstName field that you see in the code snippet below.
NET developers (The truth is there are even more, but let’s focus on the three that I see most often). When it comes to naming fields in classes, there are three types of.