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 difference between convert and parse in c#?
What are the types of constructors?
What is a class in unity?
Is c sharp free?
What do you mean by default constructor?
Why do we use ienumerable in c#?
What do u mean by delegation of authority?
What is the difference between dataset and datatable in c#?
Explain the difference between object type and dynamic type variables in c#?
What is the difference between add and addrange in c#?
How many bytes is a long c#?
What is polymorphism c# example?
What is the difference between abstract and abstraction?
What are desktop applications examples?
What are partial classes and use of partial classes?