What is the difference between readonly and const
Answer Posted / porchelvi.a
Constant:
--------
we have to initialize at the declaration itself
we could not change the value of constant variable.
Read only:
----------
we can not initialize the Read only variable during
declaration.we can initialize it in constructor only.after
that we could not change the value.Read noly is instance
based variable.
| Is This Answer Correct ? | 1 Yes | 3 No |
Post New Answer View All Answers
Can enum be null c#?
How do you prevent a class from being inherited?
What is c sharp used for?
What is the difference between add and addrange in c#?
Define thread?
How to transpose multi-dimensional array?
What is a factory in c#?
What is the difference between ienumerable and icollection?
What is the resgen.exe tool used for?
What is icollection in c#?
What is the difference between var and dynamic types in c# 4.0?
Are enums static c#?
What are the types of parameters in c#?
Are attributes inherited c#?
What is a generic class?