Explain what is the difference between constants and read-only variables?



Explain what is the difference between constants and read-only variables?..

Answer / Shoyeb Ali

Constants are immutable values that cannot be changed after they are declared, whereas read-only variables are variables whose value can only be set once at the time of declaration but can be modified using a method or property. In C#, both constants and read-only variables are denoted with the readonly keyword, but constants are initialized with a value at the time of declaration, while read-only variables can be assigned a value later.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Dot Net General Interview Questions

Explain role-based security in .Net.

2 Answers  


What are use of Cloud computing....?

1 Answers   CTS,


What is meant by globalization and localization?

1 Answers  


How does linq work?

1 Answers  


Which dll translate xml to sql in internet information server (iis)?

1 Answers  


How big is the datatype int in .net?

1 Answers  


Explain webfarm vs webgardens in .net?

1 Answers  


Tell us what is json data, and what is one way that .net developers can work with json?

1 Answers  


What is the purpose of delegates in .net?

2 Answers  


What class does icon derive from? Isn't it just a bitmap with a wrapper name around it?

1 Answers  


Explain the use of activex control in .net?

1 Answers  


Explain security measures exist for .net remoting in system.runtime.remoting?

1 Answers  


Categories