Naming rules with C #

I have this class:

class DoSomething
{
    private int timesDone;
    ...
}

What is the correct path to the named variable "timesDone"?

Sometimes I see the name m_timesDone . It's right? Where can I find naming information?

Thanks!

+3
source share
8 answers

According to MS standards, your code is ok. Having prefixes like m_ is not really required if you have an extended IDE. However, a short prefix, such as _ , can be used to use the auto-complete function to quickly sort class members.

" : , .NET" book MS

+4

. .

+5

m_timesDone.

, "private int timesDone".

, , , Code Complete.

+4

, .

this.timesDone = someInt

, 'this', . , , .

+3

prefacing m_ ++, . # -, # - Visual Studio, - , . m_.

, #, I, , IDisposable.

+3

, , , TimesDown, .
(MS, MSDN) . , backingfields : _timesDown.

+1

:

: Pascal

.

public class Program
 {
 }

e.g

public void DoSomething() { } 

: Camel Casing, . timesDown

:

   aTimesDown

:

myTimesDown

, :)

0

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


All Articles