Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

What is the difference b/w constant & read only variable?

Answer Posted / maloy.adhikari

Constants: The value can't be changed

Read-only: The value will be initialized only once from the
constructor of the class.


Const:
1)Can not be static.
2)The value is evaluated at compile time.
3)It is initialized at declaration only.
4)the const keyword is used for compile-time constants

Readonly:
1)Can be either instance-level or static.
2)The value is evaluated at run time.
3)It can be initialized in declaration or by code in the
constructor. Therefore, readonly fields can have different
values depending on the constructor used.
4)the readonly keyword is used for runtime constants.

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the advantage of using asp.net routing?

1150


Why to use html.partial in mvc?

1278


I have 2+ years of fake experience,actually i could not answer for project questions..?how can i answer please suggest me..?

3192


What is managed extensibility framework?

1046


Can you set the unlimited length for "maxjsonlength" property in config?

1032


Explain unit test done by tester on development team?

1043


Explain the role of assembly in the .net framework.

1060


What is the difference between viewbag and viewdata in mvc?

1015


Is mvc 4 supporting windows azure sdk (software development kit) ?

1081


What is the difference between partial and renderpartial?

982


What is ViewStart Page in ASP.Net MVC?

1095


What is a razor file?

1026


Explain covariance and contra-variance in .net framework 4.0. Give an example for each.

1071


mention what is the difference between ado.net and classic ado?

1159


What is the role of the jit compiler in .net framework?

1158