TICS Coding Standard Viewer 
TIOBE Software Quality Framework
Print-friendly version
©TIOBE Software www.tiobe.com
 
C# Coding Standard
Search

Rule:  5@105

This rule is Obsolete
Synopsis:Use a const field to define constant values
Language:C#
Severity Level:3
Category:Object lifecycle


Description:

Making it const ensures that memory is allocated for that item only once.

private const int maxUsers = 100;

Exception,

If the value of a constant field must be calculated at run-time (in the static constructor), use a static read-only field instead. See also [Rec:5@106].