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

Why does dllimport not work for me?

571


What benefit do you get from using a primary interop assembly (pia)?

515


What is expression tree with example?

489


What are the types of methods in c#?

461


What is c# used for in the industry?

490






Compare and contrast between the System.Array.CopyTo() and Clone()?

551


Can we have multiple threads in one app domain?

523


What is meaning of type safety in c#?

466


What is the difference between writeline and write in c#?

426


What is concrete method in c#?

492


Which attribute is used in order that the method can be used as webservice?

514


Is there hashmap in c#?

468


What is strongly typed in c#?

497


What does char mean in c#?

500


What is the difference between values and reference types?

526