Naming convention - underscore in C++ and C# variables

前端 未结 19 2341
春和景丽
春和景丽 2020-11-28 01:11

It\'s common to see a _var variable name in a class field. What does the underscore mean? Is there a reference for all these special naming conventions?

19条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-28 01:29

    Many people like to have private fields prefixed with an underscore. It is just a naming convention.

    C#'s 'official' naming conventions prescribe simple lowercase names (no underscore) for private fields.

    I'm not aware of standard conventions for C++, although underscores are very widely used.

提交回复
热议问题