what is the difference between constant and read only?

Posted by Rajendra.prasad under C# on 5/12/2011 | Points: 10 | Views : 10981 | Status : [Member] | Replies : 8
Hi,
what is the difference between constant and read only?

Regards,
Rajendra




Responses

Posted by: Vinith on: 5/12/2011 [Member] Starter | Points: 25

Up
0
Down
Hi,
Hope below links will help you

http://www.dotnetfunda.com/interview/exam3167-what-is-the-difference-between-readonly-and-const-.aspx

http://forums.asp.net/t/1240712.aspx/1

Thanks,
Vinith

Vinith Anthony

Rajendra.prasad, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ndebata on: 5/12/2011 [Member] Starter | Points: 25

Up
0
Down
Hi Rajendra,

Please dont mind to search in Dot Net Funda before posting a question, as you may find your question instead of waiting for the answer. :)

Thanks,
Debata

Rajendra.prasad, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Kunalverma31 on: 8/12/2011 [Member] Starter | Points: 25

Up
0
Down
Constant variable once assigned can't be changed, but ReadOnly variable can be changed on the fly.

Rajendra.prasad, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sandeepmhatre on: 3/23/2013 [Member] Starter | Points: 25

Up
0
Down
Refer this link

http://sandeepmhatre.blogspot.com/2013/03/constants-and-read-only.html

Sandeep M,
Software Developer
Follow me on :
http://sandeepmhatre.blogspot.in

Rajendra.prasad, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Niranjan44 on: 7/19/2013 [Member] Starter | Points: 25

Up
0
Down
The below link has good explanation
http://www.programcall.com/15/dotnet/difference-between-const-readonly-cs-.net.aspx


Rajendra.prasad, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sandeepmhatre on: 7/31/2015 [Member] Starter | Points: 25

Up
0
Down
Please refer below link for more details

http://sandeepmhatre.blogspot.in/2015/07/constant-vs-readonly-in-aspnet.html

Sandeep M,
Software Developer
Follow me on :
http://sandeepmhatre.blogspot.in

Rajendra.prasad, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Amatya on: 8/7/2015 [Member] Silver | Points: 25

Up
0
Down
http://forums.asp.net/t/1240712.aspx/1 #sthash.1FyrZamh.dpuf
Do refer

Feel free to share informations 9731764134
mail Id ' adityagupta200@gmail.com
Thanks

Rajendra.prasad, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Shreedar on: 8/15/2015 [Member] Starter | Points: 25

Up
0
Down
Constant:
1.Const can only be initialized at the time of declaration of the field.
2.Const values will be used at compile time only.

ReadOnly:
1.Readonly can be initialized at declaration time or at run time.
2.Read only values will be used at runtime only.

Regards
Sridhar Thota.

Regards

Sridhar Thota.
www.dotnet-sridhar.blogspot.com

Rajendra.prasad, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response