What is best used for private methods?

I was taught that private methods should start in lowercase, for example:

thisIsBestPractice

I have installed some code style checks, and they suggest that private methods start with uppercase.

What is the current preferred industry standard?

+3
source share
5 answers

The current industry standard is to define the standard and stick to it! The fact that you decide what your standard should be is not so important, but it is important that you all agree with it and use it. Thus, everyone knows that the camelCased method is private, although a modifier privatewould be cheap :)

FxCop - FxCop ,

+12

, . .

+4

, . .

, , . , . , (: / ). , .

, \. , .

, .

0

. , Microsoft , .

, , (_privateMethod, privateMethod, PrivateMethod, Private_Method ..), , , , . Pascal , Visual Studio, , . - , - .

0

I always knew the names of the methods in upper case, regardless of whether they are public or private. I often use The Elements of C # style, they suggest using PASCAL naming conventions such as uppercase storage.

public void AnExample()
{
}

http://www.amazon.co.uk/Elements-C-Style-Kenneth-Baldwin/dp/0521671590

Good reading, you can definitely find it cheaper, though.

In the end, it comes down to coding standards, regardless of whether they are decided by yourself or by the organization in which you work.

0
source

Source: https://habr.com/ru/post/1726394/


All Articles