What is the Difference between read only and constant
variables?

Answer Posted / raju

1.We can assign value to readonly field, only in
constructor or while declare the variable.But in case of
const we should assign a value while declare.
2.const=static readonly

Is This Answer Correct ?    3 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is it true that all c# types derive from a common base class?

720


What is the C# syntax to catch any possible exception?

700


who is a protected class-level variable available to?

712


Describe a Struct ?

727


What is oledb in c#?

702


In which situation(s), the use of "Delegate" is a good idea?

741


list the steps in code compilation in c#?

643


How can you access a private method of a class?

668


What are some examples of desktop applications?

677


How does a while loop work?

634


How do you comment in c#?

689


What are the concepts of dispose method?

674


How many bytes is an int c#?

663


Can a abstract class have a constructor?

631


Are objects passed by reference in c#?

710