C# coding standards” Use the const directive only on natural constants

Posted by Nathan Wilfert on Programmers See other posts from Programmers or by Nathan Wilfert
Published on 2012-11-27T16:15:55Z Indexed on 2012/11/27 17:18 UTC
Read the original article Hit count: 690

Filed under:
|

I've seen these 2 guidelines in coding c# standard and I’m not sure the what the 2nd one means.

  1. With the exception of zero and one, never hard-code a numeric value; always declare a constant instead.
  2. Use the const directive only on natural constants such as the number of days of the week.

1st what is the definition of a natural constants and if the number is not a natural constants given the 1st rule how does one declare a constant in c# without the const directive?

See http://www.scribd.com/doc/10731655/IDesign-C-Coding-Standard-232 for reference.

© Programmers or respective owner

Related posts about c#

Related posts about coding-standards