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 are native functions?

668


Does c# support properties of array types?

730


Where is the main method in c#?

758


What is int32 maxvalue?

749


Which of these string definitions will prevent escaping on backslashes in c#?

790


Does c# support multilevel inheritance?

675


Explain concurrency with aop?

756


What is .dbml file?

697


Can hashtable have duplicate keys?

682


What kind of the information stored inside the assembly?

778


Why is main static in c#?

730


Explain static class members.

797


What is difference between dictionary and list in c#?

696


explain the features of static/shared classes.

723


What is the difference between struct and class c#?

729