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 tempdata?

991


What are ajax helpers in mvc?

898


what is .edmx file and what it contains?

988


Describe the .net framework architecture.

1012


How to use Jquery Plugins in ASP.Net MVC validation?

986


What is .net core framework?

928


What is entitycontainer? : Entity framework

972


What is mvc entity framework?

905


How do I install .net framework?

903


i just want to write an exam regarding .net?plz give me information about taking a test?where to pay 4 d exam,exam centre?

2182


What are the options can be configured in AJAX helpers?

950


Explain how to use multiple submit buttons in ASP.Net MVC?

1153


How does .net framework works?

957


what is split entity?

1009


Can you explain renderbody and renderpage in mvc?

974