Unlocking Microsoft C# V 2.0 Programming Secrets (Wordware Applications Library)

 

Declaring a Number as a Constant

If a number is declared as a constant in a Visual Studio C# project, then the declaration must appear in the class declaration and the constant must be assigned a value in that declaration. Once a number is declared a constant, the number cannot be changed in the code.

public const double dblFearFactor = 7.22;

 

Категории