What is the Difference between read only and constant
variables?
Answer Posted / vijay bhaskar semwal
some more difference
Unlike const, when using readonly, the value is set when
the instance is created. This means that you can specify
the value of the readonly in the constructor of your class.
Another difference between const and readonly, is that
const are static by default, where with readonly, you must
define it as static (if you want it to be).
| Is This Answer Correct ? | 2 Yes | 1 No |
Post New Answer View All Answers
What is static void main in c#?
Give some examples of commonly used i/o classes?
What are the different states of a thread?
What is func c#?
How do you comment out code in c#?
State the top.NET class that everything is derived from?
What is the difference between icomparer and icomparable in c#?
What is parsing?
What is namespace c#?
Why do we need to override in c#?
What is executereader in c#?
How many types of collections are there in c#?
What is the output of TextWriterTraceListener redirected?
What is the difference between interface and inheritance in c#?
Explain async and await?