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


Please Help Members By Posting Answers For Below Questions

What does int32 mean?

678


Is linkedhashset synchronized?

850


What is console write in c#?

695


Is and as keyword in c# net?

765


What does typeof return c#?

731


What is the difference between throw and throw ex?

671


How big is a 64 bit integer?

685


What is array formula?

688


What is dynamic in c#?

676


What is data binding c#?

731


What is difference between ienumerable and ienumerator in c#?

730


What is literal in c#?

676


What does console readline do in c#?

687


Is multiple inheritance possible in c#?

792


What is a console device?

689