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
What is disco?
What are satellite assemblies?
What are the types of assembly available
How do I create a multilanguage?
What is the delegate in c#?
What do you mean by default constructor?
What is the relation between classes and objects?
Are c# strings immutable?
How does the clr work?
What is a .aspx file?
Is it possible to force garbage collector to run?
What is gridview c#?
Is c# 8 released?
Do events have return type c#?
Why do we need static in c#?