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
Explain the different types of delegates used in c#.
Can we make a Static Constructor Parameterized? Give Reason with your answer
What is the difference between class and namespace?
How to implement delegates in c#.net
Where do we set the min and max pool size for connection pooling?
How does yield return work c#?
What is session and cookies in c#?
Which of the following API is used to hide a window?
Can an array be null c#?
How to implement a singleton design pattern in c#?
Explain the three services model (three-tier application). Presentation (ui), business (logic and underlying code) and data (from storage or other sources).
What do you mean by casting a data type?
What is master page in asp net c#?
What is singleordefault c#?
What is view state c#?