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 between read only and constant
variables?

Answer Posted / akshay

Constants :

* Constant value. Cannot be changed once initialized.
Should be Initialize the value where it declared.
* Const value fully evaluated at compile time
* By default static
* Possible to declare within function

Readonly :

* Could be declare as Static or Non Static
* Assign the value where it declared or can be assigned in
constructor
* Could not declare within function
* can be initialized in compile time or in runtime.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a multicast c# delegate?

998


can you allow a class to be inherited, but prevent the method from being over-ridden?

897


What is difference between first and firstordefault?

866


What is the lock statement in c#?

930


What is ildasm and obfuscator in net?

888


What is inner class in c#?

907


How to use exception handling in stored procedure?

972


Are structs faster than classes?

876


What are value types and reference types?

1042


can multiple catch blocks be executed for a single try statement?

926


Is c# still popular?

828


What is difference between ienumerable and list in c#?

822


Why use a singleton instead of static methods?

839


What is the difference between CreateObject() and GetObject()?

1021


How Global.asax is used ?

996