what is the main differnce between const,readonly and static

Answer Posted / komilla shaheen

const is the keyword where we can intialize the variable
with some value which is constant throughout the program it
cannot be changed.
static is the keyword which is intialized at complile time
and had to change at compile time only.
readonly is for the varible which is readonly cant be
changed.

Is This Answer Correct ?    9 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

If c# destructors are so different to c++ destructors, why did ms use the same syntax?

739


If a method's return type is void, can you use a return keyword in the method?

716


Explain how to add controls dynamically to the form using c#.net.

757


Is static thread safe?

671


How we can create an array with non-default values?

741


Explain the access modifiers in c#?

701


How many types of variables are there in c#?

732


Explain the difference between Metadata and Manifest

753


What are tuples c#?

715


Does c# have a 'throws' clause?

793


what is the index value of the first element in an array?

703


What is args c#?

725


What is concatenation and when should it be used?

725


What is COM Interoperability?

771


Can constructor be private c#?

668