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 the ouput of the following program?
I was trying to use an out int parameter in one of my functions. How should I declare the variable that I am passing to it?
Is lazy thread safe c#?
What is attribute and reflection in c#?
Explain the role of the datareader class in ado.net connections?
Can a static class contain non static members?
Can hashtable have duplicate keys in c#?
what are pointer types in c#
What is static variable in c#?
What is an int c#?
Is there an equivalent to the instanceof operator in visual j++?
What is a satellite assembly in c#?
What is the difference between c and c sharp?
What is difference between ienumerable and list in c#?
Give examples for reference types?