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
How many parameters can a method have c#?
Explain the Different types of configuration files in .net?
Do events have return type c#?
What is cosole application?
What is iqueryable?
what is a constructor? What is a destructor?
What is the use of delegates in c#?
Why do we use delegates in c#?
How does bitwise work?
What are generic types?
Can an abstract class inherit from another abstract class c#?
What is dataview c#?
What are the examples of data types?
What are the collection types can be used in c#?
Can you explicitly call a destructor?