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

Explain types of comment in c# with examples

578


Is array value type in c#?

681


Can you store different types in an array in c#?

575


What is private constructor c#?

587


What is instantiating a class?

598






What is garbage collection? How to force garbage collector to run?

573


Can we change static value in c#?

606


What is the difference between returning iqueryable vs ienumerable?

548


What is a Jagged Array in C#?

636


What are delegate methods?

565


What are events in C#?

640


What is yield break in c#?

601


What is meant by desktop application?

582


What is foreach loop in c#?

611


What is the real use of interface in c#?

537