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 are the boolean data types in c#?

696


Why are mutable structs evil?

714


Which programming language is best for desktop applications?

682


Is static thread safe?

662


What is the difference between array and list in c#?

666


Are c# strings immutable?

684


Explain namespaces in c#.

767


Explain About disco and uddi

907


What is xslt in c#?

651


What is meant by console programming?

667


Does a loop recorder have to be removed?

798


What is console writeline in c#?

652


What is a .aspx file?

637


What is the difference between const and readonly in c#.net?

707


What is the use of list in c#?

650