What's the difference between const and readonly ?

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the components required to create a route in mvc?

611


What is session state management?

570


What are the advantages of razor view engine?

531


How we can call a JavaScript function on the change of a Dropdown List in ASP.Net MVC?

564


What are the advantages of asp.net mvc?

565






What is presentation framework?

550


Is .net framework going away?

564


What is the use of action filters in an mvc application?

610


Explain tempdata in mvc?

568


What is edm (entity data model)? : Entity framework

553


What are the benefits of .net framework?

568


How to update one of my table in database at 4pm every day how it is possible?

555


Which version of .net framework is installed?

496


What are ajax helpers in mvc?

526


Mention what is the difference between “ActionResult” and “ViewResult” ?

578