what is the main differnce between const,readonly and static

Answer Posted / raja

1. we can initialize constant variable only at the
declaration where as readonly varaiable can be initialized
at either declaration or in constructor.

2. we can't use static modifier for the const variable
where as readonly variable can be declared as static

Is This Answer Correct ?    5 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between list and array in c#?

666


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

746


Define an array?

706


What is signature c#?

670


What is null in database?

654


What are the different approaches of passing parameters to a method?

719


What is the difference between and xml documentation tag?

758


What are indexers in c# .net?

723


Explain the difference between the system.array.copyto() and system.array.clone()?

702


Does console.writeline() stop printing when it reaches a null character within a string?

739


Why do we use stringbuilder in c#?

706


What is form feed and carriage return?

685


What is the system namespace?

677


Why do we need encapsulation in c#?

721


Why do we use yield in c#?

676