Berikut adalah aturan penamaan class, variable, function, atau item lainnya dalam C#:
- Nama harus diawali dengan sebuah huruf baru kemudian dapat diikuti dengan hurup lainnya, angka, atau garis bawah (underscore). Karakter pertama tidak boleh angka.
- Tidak boleh mengandung spasi dan simbol-simbol seperti ? - +! @ # % ^ & * ( ) [ ] { } . ; : " ' / dan \. Kecuali underscore ( _ ).
- Tidak boleh menggunakan nama yang merupakan keyword C#.
Reserved keyword
| abstract | as | base | bool | break | byte | case | 
| catch | char | checked | class | const | continue | decimal | 
| default | delegate | do | double | else | enum | event | 
| explicit | extern | false | finally | fixed | float | for | 
| foreach | goto | if | implicit | in | in (generic modifier) | int | 
| interface | internal | is | lock | long | namespace | new | 
| null | object | operator | out | out (generic modifier) | override | params | 
| private | protected | public | readonly | ref | return | sbyte | 
| sealed | short | sizeof | stackalloc | static | string | struct | 
| switch | this | throw | true | try | typeof | uint | 
| ulong | unchecked | unsafe | ushort | using | virtual | void | 
| volatile | while | 
Contextual keyword
| add | alias | ascending | descending | dynamic | from | get | 
| global | group | into | join | let | orderby | partial (type) | 
| partial (method) | remove | select | set | 
Click here if you like this article.
 
 
 
 
 
0 Comments