Code cleanup: should fields, variables, and properties be declared at the top or bottom of the class?

Is the ad at the bottom of C # code quite common?

I saw some examples where this is done.

There are tools like Resharper that help organize the source code, is it possible to specify where it should create regions for me?

+5
source share
4 answers

This is a stylistic discussion, because with most compilers, placing at the top or bottom of the (class file) does not affect the results. Historically, many people do this upstairs, but I like to leave them downstairs.

Why?

, -, - ​​ intellisense, . , - , . , VS, , , . , Visual Studio F12 Ctrl + End .

, , . . , , ReSharper, , , , , ReSharper . , , , , .

Edit:

, #region: , , . , . , #region, ?

+4

. StyleCop... , ... ... ,

+3

AFAIK . : /, , . .

, , , . , , ( , , ).

+1

() :

. , , . , . , .

+1

All Articles