I saw these two approaches for declaring constants to be used in a project.
Constants in the open module.
Constants in the NonInheritable (Sealed) class
Does anyone use a different approach for declaring constants?
Is there any difference between these approaches, any pluses and minuses?
Thanks.
Put the constant in the class where it is most important - for example. Math.Pi, Int32.MinValueetc.
Math.Pi
Int32.MinValue
I saw various constants that should also be listed, in particular for status codes, etc.
, ( ) , , .
@Jon. , , .. , .., . . , , .
, . , , .
Utility ( ). , , /, . .
, , . , , - , .
, ,
.
In practice, only one of the dozens of enum and constants ever had to be declared in both service modules. Most of them are Win32 slowdowns used by the Win32 function, which are imported into my assembly.