Of course, at the top of the .java or .cs file there is a package declaration / namespace followed by the import / using statement.
But what kills me, where should I put a variable declaration? At the top or bottom?
This is how I prefer:
package/namespace declaration import/using declaration of microsoft's/java namespaces import/using declaration of standard 3rd party namespaces import/using declaration of my personal namespaces constructors private methods, each preceded by any private variable that was first used. protected methods, each preceded by any private variable that was first used. public methods, each preceded by any private variable that was first used. inner/nested classes and enums private anon classes assignment protected variables/anon classes assignment public variables/assigned anon classes assignment
But I understand that many people like to add all the variables right at the top after the package / namespace and import / use declarations. This is troublesome, because sometimes the number of variables and assigned anon classes gets too many, which hides the visibility of the constructors - the first lines I need to see are the constructors because they tell me the signature of the instance.
anon, - " ", .
, .
Java , . , . , , . # ( ),
using statements namespace private static fields private static methods/properties public static methods/properties private fields private methods/properties protected methods/properties public methods/properties
, , , ( , ). , .
, ( )
, . , using, , , , , , . , , -, , , , . ; , , , .
using
, , . , #region. , , , , -, , , .
#region
, , , , , . , "" , , , , , .
Source: https://habr.com/ru/post/1755589/More articles:Is it possible to find the location of another Android phone? - androidCustom HTTP verb with jQuery.ajax () - jqueryCan someone give me an example when the console application accesses the azure - c #https://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1755587/adding-custom-tag-buttons-to-jwysiwyg&usg=ALkJrhgx5MqSJW4orgdzd7xQoYmMAh7OmQHow to print in pdf using php with canvas element - jqueryPHP - преобразование строк в деньги - phpData loss during WPF clipboard operations - c #Чтение и запуск файла Powershell из текста - fileDropdown menu with prototype.js in IE - javascriptSQL Magento Sales Report - sqlAll Articles