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 / bharathi

Constants:
constant is used for declaring variable as constant and this constant value cannot be modified once after declartration.

It is must to declare the constant value at the time of declaration only.
Example:
constant int y=5;

Readonly

Readonly variables can not be modified like constant,but it is after initialization.
So.it is not mandatory to initialize those variables at declaration time.they can also be initialize after declaration.

Example:
readonly int x;

add()
{
x=5;
}


Both after initilization, we can not modify those values again.

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 out in c#?

876


What is int parse in c#?

906


What is the wildcard character in sql?

974


Explain static class members.

990


What's your approach to fetch static data in your windows form application?

937


Can properties be private in c#?

843


Assembly Code. in Rejester AL. How do Contast Replece( or Change): Bit D3 With Bit D4 and Bit D2 With Bit D5 and Bit D1 With Bit D6 and Bit D0 With Bit D7 I am Not Know Very Well Write English.

1829


Name the control which cannot be placed in mdi?

838


Explain about multithreading?

959


What kind of the information stored inside the assembly?

938


what are the contents of an assembly ?

934


What does an indexer do?

818


What is remote data?

786


Define Final Class in C#

966


What is the difference between finalize() and dispose()?

865