what is the main differnce between const,readonly and static

Answer Posted / vijay rana

const is used to create a constant value which will be
constant throuout the class

static is used for a commaon variable for all objects, it is
not part of a object, it is a part of class, every object
will share this value,
read,

there are many situation in which we want to intialize the
value of a constat variabl at run time, in which we can have
different values for different objects, with the help of
readonly we can define the value of any object at runtime
which will not be changed later

Is This Answer Correct ?    6 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why do we use stringbuilder in c#?

725


Why do we need indexers in c#?

686


What is difference between list and ilist in c#?

660


Explain acid rule of thumb for transactions in c#.

748


Can arraylist store different data types in c#?

713


What is executenonquery c#?

687


What is the difference between field and variable in c#?

720


What are the various components in crystal reports?

740


What is c sharp used for?

685


What is parsing?

730


Is multilevel inheritance possible in c#?

681


What is the purpose of dependency injection?

720


What is the xml document structure?

702


Is double a decimal?

729


How do I use the 'using' keyword with multiple objects?

745