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

How do you pronounce c#?

576


Describe the process of “exception handling implementation” in c#?

596


What is difference between var dynamic and object in c#?

588


What is dataadapter c#?

554


Is there an equivalent of exit() for quitting a c# .net application?

599






Explain About .NET Framework

601


How to use exception handling in stored procedure?

626


Is c# queue thread safe?

582


What is the main usage of keyword “virtual” ? How does it work for a method or property?

594


What are Uses of CLR

618


What's the difference between a method and a procedure?

577


How many classes are there in classification?

584


What is verbatim literal in c#?

574


What is data bind in c#?

616


Can a sealed class be used as a base class?

604