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 the use of ienumerable in c#?
What is class method c#?
What is type system in c#?
What you mean by inner exception in c#?
What is a service layer c#?
Is as keyword in c#?
Explain how do you directly call a native function exported from a dll?
What is sqlconnection in c#?
What is the difference between IEnumerator and IEnumerable?
What are the advantages of using c#?
How do I open the console?
Explain the differences between static, void and public in c#?
How long does a loop recorder procedure take?
What is the correct way of declaring an xml namespace?
How does one compare strings in c#?