What is the difference between readonly and const
Answer Posted / chandan kumar
The read only keyword is different from the const keyword. A
const field can only be initialized at the declaration of
the field. A read only field can be initialized either at
the declaration or in a constructor. Therefore, read only
fields can have different values depending on the
constructor used. Also, while a const field is a
compile-time constant, the read only field can be used for
runtime constants as in the
Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
What is difference between string and stringbuffer in c#?
what is the difference between a struct and a class in c#?
Is php easier than c#?
Which string method is used for concatenation of two strings in c#?
What is oledb in c#?
Explain how can I get around scope problems in a try/catch?
What is transparent caching with aop ?
How do I create a multi language, multi file assembly?
What does it mean?
What is the use of delegates in c#?
How we convert private assembly into public assembly?
Why is it efficient to use System.string under System.Text.StringBuilder ?
Explain the difference between abstract class and interface.
Can structs in c# have destructors?
What is the use of 'using' statement in c#?