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
What is a lambda expression in c#?
What is the reason behind the invention of c#?
Is xml tags are case sensitive?
What are the basics of c#?
What's difference between constants and static readonly?
What is a deadlock lock?
What does mean before a string in c#?
Which is better interface or abstract class in c#?
What is an actual parameter?
What is the difference between class and namespace?
if you do have a stack overflow profile.what is your ranking?
What do you use c# for?
Is a decimal an integer?
Why delegates are type safe in c#?
What is a c# delegate?