Differentiate read-only variables and constants

Difference between read-only variables and constants which are used in programs?

E

Expert

Verified

The constants perform similar tasks as the read-only variables with a number of differences. Differences between read-only and constants are as follows:

Constants:

1. Constants deal at compile-time.

2. It supports value-type variables.

3. It must be used when it is not likely that the value will ever modify.

Read-only:

1. Read-only variables are estimated during runtime.

2. These variables could hold reference type variables.

3. These variables must be used when run-time calculation is needed.

   Related Questions in DOT NET Programming

©TutorsGlobe All rights reserved 2022-2023.