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's the difference between const and readonly ?

Answers were Sorted based on User's Feedback



What's the difference between const and readonly ?..

Answer / kirti

You can initialize readonly variables to some runtime values. Let's say your program uses current date and time as one of the values that won't change. This way you declare public readonly string DateT = new DateTime().ToString().

Is This Answer Correct ?    0 Yes 0 No

What's the difference between const and readonly ?..

Answer / mr vinod kumar

The readonly keyword is different from the const keyword. A const field can only be initialized at the declaration of the field. A readonly field can be initialized either at the declaration or in a constructor. Therefore, readonly fields can have different values depending on the constructor used. Also, while a const field is a compile-time constant, the readonly field can be used for runtime constants as in the following example:
public static readonly uint l1 = (uint) DateTime.Now.Ticks;
What does a character do ?
On most systems, produces a rather annoying beep.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Dot Net Framework Interview Questions

What meant of assembly & global assembly cache (gac) & Meta data

1 Answers  


How to add 'ASPNET.mdf' file into server explorer in visual studio 2005?

2 Answers  


Explain covariance and contra-variance in .net framework 4.0. Give an example for each.

0 Answers  


How can I stop my code being reverse-engineered from IL

1 Answers  


What is tracing?Where it used.Explain few methods available

1 Answers  


Can we add constraints to the route? If yes, explain how we can do it?

0 Answers  


What is Global Assembly Cache (GAC) and what is the purpose of it?

2 Answers  


Difference between ASP.NET MVC and ASP.NET WebForms?

0 Answers  


What does assert() method do?

1 Answers   MCN Solutions, Siebel Systems,


What is the difference between managed and unmanaged code?

12 Answers   IBM,


Where is the new functionality in the .net framework 3.0 (such as wcf, wf, wpf, and cardspace) installed to? Is that different from where the .net framework 2.0 is installed to?

0 Answers  


What are the contents of assembly?

2 Answers  


Categories