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's the difference between system.string and system.text.stringbuilder classes?

517


What is windows forms in c#?

467


How to add controls dynamically to the form using c#.net.

467


What is append in c#?

471


What are extensions methods in c#?

463






What is the process of delegation?

482


What is the use of parse in c#?

448


Which function is the entry point for a DLL in MS Windows 3.1?

675


Explain the 3 types of properties in c# with an example?

537


What does a constructor do c#?

486


How to transpose multi-dimensional array?

549


What is strong data type in c#?

474


Can abstract class be sealed in c#?

460


Is list immutable in c#?

478


What is the resgen.exe tool used for?

517