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
How does the clr work?
Can a struct have a default constructor (a constructor without parameters) or a destructor in c#?
Explain get and set accessor properties?
What is the meaning of extention?
What do you know about device context?
What is a dimensional array?
What is ienumerable <> in c#?
Why is c# good for games?
Which is faster dictionary or list?
What do you mean by expression tree?
What are the 2 broad classifications of data types available in c#?
Whats an assembly? Describe the importance of assembly?
Enlist the different types of classes in c#?
What are the advantages of using delegates in c#?
What is a multi line comment?