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 meaning of console writeline in c#?
What is pure abstract class in c#?
Can you specify an access modifier for an enumeration?
What does immutable mean in c#?
Explain boxing and unboxing in c#?
What is difference between private and static constructor?
Is c# an open source?
What is byte c#?
Explain the difference between // comments, /* */ comments and /// comments?
Does c# do array bounds checking?
How many classes are there in classification?
What Is A Satellite Assembly?
How do I create multifile assembly?
What is the use of system.environment class in c#.net?
What is difference between private and protected?