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

What does readonly mean in c#?

931


How to move to a state-related codebase?

1473


Can I fly with a loop recorder?

862


Why does dllimport not work for me?

984


What is the purpose of abstract class in c#?

868


What is the .NET collection class that allows an element to be accessed using a unique key?

1063


Can struct be static in c#?

994


Can hashtable have duplicate keys?

846


In c#, what will happen if you do not explicitly provide a constructor for a class?

906


Why do we use anonymous method in c#?

875


Is a char?

822


What is the default value of date?

876


Explain partial class in c#?

857


How do I run managed code in a process?

957


How to find the current application file path while runtime?

927