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
What is use of list in c#?
Is c# the same as d flat?
Is a decimal an integer?
What are the return types in c#?
What is difference between array and arraylist c#?
Why do we need indexers in c#?
Define c# i/o classes? List the commonly used classes?
What is boolean method?
Define acid rule of thumb for transactions in c#.
Structs are largely redundant in c++. Why does c# have them?
What are the advantages of properties in c#?
How do you declare an arraylist?
What are the types in c#?
If the original method is not static you can declare an override method to be static or not?
What does using system mean in c#?