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

What is xslt in c#?

627


How to use delegates with events?

742


What is part of a method signature in c#?

638


What is parameter c#?

703


Why singleton is sealed?

628






What is dynamic object in c#?

670


Can we make a Static Constructor Parameterized? Give Reason with your answer

744


How many constructor can a class have?

663


Which controls do not have events?

726


What are functions in c#?

650


Define thread? Explain about multithreading?

723


Can we customize the serialization process?

683


What does assert() do in c#?

727


What does immutable mean in c#?

686


What is the difference between Java and .NET garbage collectors?

693