What is the Difference between read only and constant
variables?
Answer Posted / akshay
Constants :
* Constant value. Cannot be changed once initialized.
Should be Initialize the value where it declared.
* Const value fully evaluated at compile time
* By default static
* Possible to declare within function
Readonly :
* Could be declare as Static or Non Static
* Assign the value where it declared or can be assigned in
constructor
* Could not declare within function
* can be initialized in compile time or in runtime.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Which programming language is best for desktop applications?
Is hashset serializable c#?
What is the difference between static and private constructor in c#?
What is multicast delegate explain with example?
When Should You Call The Garbage Collector In .net?
What is a collection in c#?
Define satellite Assembly?
list the steps in code compilation in c#?
Why do we use partial class in c#?
Are there functions in c#?
What is use of a HashTable in .NET?
What is the difference between system.text.stringbuilder and system.string?
What is the difference between list and array in c#?
What is the difference between ienumerable and enumerator?
List some of the classes used by system.data namespace?