АкушерствоАнатомияАнестезиологияВакцинопрофилактикаВалеологияВетеринарияГигиенаЗаболеванияИммунологияКардиологияНеврологияНефрологияОнкологияОториноларингологияОфтальмологияПаразитологияПедиатрияПервая помощьПсихиатрияПульмонологияРеанимацияРевматологияСтоматологияТерапияТоксикологияТравматологияУрологияФармакологияФармацевтикаФизиотерапияФтизиатрияХирургияЭндокринологияЭпидемиология

C# programming guidelines

Def: The guidelines is you need to bear in mind when writing C# programs.

Desc: 1) Rules for identifiers. Identifiers are the names you give to variables, to user-defined types such as classes and structs, and to members of these types. Identifiers are case-sensitive. Rules determining what identifiers you can use in C#: They must begin with a letter or underscore, although they can contain numeric characters, You can’t use C# keywords as identifiers. Ex: Name, _Identifier

2) Usage Conventions. In any development language, there usually arise certain traditional programming styles.

Naming Conventions. The general philosophy in the.NET Framework is also that the name of a variable should reflect the purpose of that variable instance and not the data type. Ex: height.

Casing of Names. In many cases you should use Pascal casing for names. Pascal casing means that the fi rst letter of each word in a name is capitalized. Ex: EmployeeSalary. The only other casing scheme that you are advised to use is camel casing. Camel casing is similar to Pascal casing, except that the first letter of the first word in the name is not capitalized. Ex: employeeSalary.

Name Styles. You should be consistent about your style of names. Ex: ShowConfirmationDialog(),ShowWarningDialog()

Namespace Names. it’s almost always a good idea to create a top-level namespacewith the name of your company and then nest successive namespaces that narrow down the technology,group, or department you are working in or the name of the package your classes are intended for.

Ex: WeaponsOfDestructionCorp.Viruses

Names and Keywords. The names do not clash with any keywords. If you attempt to name an itemin your code with a word that happens to be a C# keyword, you’ll almost certainly get a syntax errorbecause the compiler will assume that the name refers to a statement.

Use of Properties and Methods. The rules here are not hard and fast, but in general, you ought to use a property if something really should look and feel like a variable. Otherwise, you should use a method. Ex: Password, SetPassword(). Use of fields. The guidelines are pretty simple here. Fields should almost always be private, except that in some cases itmay be acceptable for constant or read-only fields to be public.


Дата добавления: 2015-09-18 | Просмотры: 562 | Нарушение авторских прав



1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 |



При использовании материала ссылка на сайт medlec.org обязательна! (0.002 сек.)