What is the Difference between read only and constant
variables?
Answer Posted / kishore maddineni
all above answers are correct.But there is another point.
readonly variable can be assigned at declaration or at run
time which is must be in constructor. Readonly value can't
be modified.
Constant variable must be assigned at the time of
declaration only ,which is can't be modified.
Is This Answer Correct ? | 36 Yes | 7 No |
Post New Answer View All Answers
What is the relation between classes and objects?
How can I get around scope problems in a try/catch?
Can abstract class have private constructor c#?
What is difference between var dynamic and object in c#?
Why do we use reflection in c#?
What are the different approaches of passing parameters to a method?
What is anonymous types in c#?
Difference between StackPanel and RelativePanel ?
What is the difference between list and arraylist c#?
What is datatable and dataset in c#?
What is singleordefault?
Where do we use serialization in c#?
Is array thread safe c#?
What will be the output of the following code?
Is it possible to have a static indexer in c#?