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
Can a child class call the constructor of a base class?
What are the concepts of dispose method?
Can property be private in c#?
What do you understand by the terms datareader object and dataset object?
What is the difference between abstract class and interface in c#?
How long will it take to learn c sharp?
what is the purpose of using statement in c#
How do you create dlls in .NET
Can you inherit from a static class in c#?
Define thread?
Tell me the difference between call by value and call by reference.
What is the base class for array types?
What is the main method in c#?
What's the difference between an integer and int?
What do you mean by generic class in c#?