What is the difference between readonly and const
Answer Posted / sabina
both meant for constant values. a const field can only be
initialized at the declaretion of the field. a read only
field can be initialized either in initialization or in
constructer. therefore , reaadonly field can have different
values depending on the constructure used
also a const field is compile time constant , readonly
field can be used for runtime constants
| Is This Answer Correct ? | 18 Yes | 2 No |
Post New Answer View All Answers
Why do we need private constructor in c#?
Why is c# a good programming language?
What is parseexact c#?
What is a shared assembly?
Describe the ways of cleaning up objects in c#.
What is the difference between int and int in c#?
Are cao stateful in nature?
What are the properties of a string class?
What is eager loading in c#?
Define strong name in c#?
Whats an assembly? Describe the importance of assembly?
What is assembly manifest?
Why do we use delegates in c#?
What is the use of xmlserializer?
What is the base class of all classes in c#?