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 readonly and const

Answer Posted / sabina

both meant for constant values. a const field can only be
initialized at the declaretion of the field. a read only
field can be initialized either in initialization or in
constructer. therefore , reaadonly field can have different
values depending on the constructure used

also a const field is compile time constant , readonly
field can be used for runtime constants

Is This Answer Correct ?    18 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain what is copy constructor?

1068


How to sort an int array in c#?

1008


Explain the importance and use of each, version, culture and publickeytoken for an assembly.

993


What is the compiler of c#?

991


What is the purpose of constructor in c#?

897


Can we have static indexer in c#?

948


Can abstract class have constructor?

919


Can a class be private in c#?

1037


Why c# is called type safe language?

888


What does int32 mean in c#?

945


Why do we need collections in c#?

918


What is satellite assembly? And steps to create satellite assembly?

1046


What are anonymous functions in c#?

993


What is the difference between values and reference types?

1050


Why do I get an error (cs1006) when trying to declare a method without specifying a return type?

975