[Previous] [Contents] [Next]

Constants vs. Read-Only Fields

There will certainly be times when you have fields that you do not want altered during the execution of the application-for example, data files your application depends on, the value of pi for a math class, or any value that you use in your application that you know will never change. To address these situations, C# allows for the definition of two closely related member types: constants and read-only fields.

[Previous] [Contents] [Next]