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 viewstart page in mvc?

962


Does .NET Framework support SAX?

946


What is .net architecture and framework?

984


Mention the core components of .net framework?

925


What is the 'page life cycle' of an ASP.NET MVC?

998


What is entityset? : Entity framework

980


Can you Write the GC(Garbage Collector) Algoritham in .NET? (But not Explination of Working of GC).

2234


What are the difference between asynchronous controller implementation between asp.net mvc 3 & asp.net mvc 4?

1030


What are sections?

1058


How does the .net framework 3.0 relate to the .net framework 2.0?

997


What is the difference between .net core and .net framework?

931


What is the full form of sp?

917


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

960


Is it possible to combine asp.net webforms and asp.mvc and develop a single web application?

947


Is .net framework dead?

967