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

Answer Posted / vathsala

A quick synopsis on the differences between 'const'
and 'readonly' in C#:

'const':
1.Can't be static.
2.Value is evaluated at compile time.
3.Initiailized at declaration only.

'readonly':
1.Can be either instance-level or static.
2.Value is evaluated at run time.
3.Can be initialized in declaration or by code in the
constructor.

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between method overriding and method overloading?

952


What is strong data type in c#?

883


Name any three ways to pass parameters to a method in c#?

922


How many bytes is a char c#?

893


Structs are not reference types. Can structs have constructors?

976


How to get the sum of last 3 items in a list using lambda expressions?

935


What is the difference between null and string empty in c#?

903


Does c# provide copy constructor?

1012


Why do we write system in c#?

916


How do you sort a list in c#?

861


Can we use "this" command within a static method?

998


What is the root element of an xml file?

866


What is the difference between // comments, /* */ comments and /// comments?

843


Define acid rule of thumb for transactions in c#.

897


What is the difference between integer and double?

918