Changes

C Sharp Variables and Constants

302 bytes added, 16:44, 11 January 2008
What is a C# Constant?
<pre>
const int interestRate = 10;
</pre>
 
Note that a constant, unlike a variable, must be initialized at the point that it is declared. For example, the follwoing code:
 
<pre>
const int interestRate;
</pre>
 
will result in a compilation error along the lines of ''A const field requires a value to be provided''.