Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# naming convention for constants?

private const int THE_ANSWER = 42; 

or

private const int theAnswer = 42; 

Personally I think with modern IDEs we should go with camelCase as ALL_CAPS looks strange. What do you think?

like image 506
mmiika Avatar asked Oct 28 '08 08:10

mmiika


People also ask

Bahasa C digunakan untuk apa?

Meskipun C dibuat untuk memprogram sistem dan jaringan komputer namun bahasa ini juga sering digunakan dalam mengembangkan software aplikasi. C juga banyak dipakai oleh berbagai jenis platform sistem operasi dan arsitektur komputer, bahkan terdapat beberepa compiler yang sangat populer telah tersedia.

Apa yang dimaksud dengan huruf C?

C adalah huruf ketiga dalam alfabet Latin. Dalam bahasa Indonesia, huruf ini disebut ce (dibaca [tʃe]).


1 Answers

The recommended naming and capitalization convention is to use PascalCasing for constants (Microsoft has a tool named StyleCop that documents all the preferred conventions and can check your source for compliance - though it is a little bit too anally retentive for many people's tastes). e.g.

private const int TheAnswer = 42; 

The Pascal capitalization convention is also documented in Microsoft's Framework Design Guidelines.

like image 103
Greg Beech Avatar answered Sep 30 '22 18:09

Greg Beech