- Constants are immutable values which are known at the compile time.
- They do not change for the life of the program
- C# built in types may be declared as constants
- User-defined types including Classes, structs , arrays cannot be 'const'
- C # does not support const methods,properties or events
- When a complier encounters a const identifier in c# source code, it substitutes the literal value into the intermediate language(IL) code the produces
- Because there is no variable address associated with a constant at run time.
- Constant fields cannot be passed by reference
- Constants are marked by public,private,protected,internal.
Friday, September 2, 2011
C# Constants
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment