What is the difference between readonly and const
Answer Posted / porchelvi.a
Constant:
--------
we have to initialize at the declaration itself
we could not change the value of constant variable.
Read only:
----------
we can not initialize the Read only variable during
declaration.we can initialize it in constructor only.after
that we could not change the value.Read noly is instance
based variable.
| Is This Answer Correct ? | 1 Yes | 3 No |
Post New Answer View All Answers
What is generic in c#?
Are value types sealed?
How to assign Null value to Var?
Why use “using” in c#?
Explain the types of errors in c#?
How long will it take to learn c#?
Are objects passed by reference in c#?
If you define a user defined data type by using the class keyword, is it a value type or reference type?
What is a callback c#?
What is instantiating a class in c#?
How do you declare an interface in c#?
Which of these string definitions will prevent escaping on backslashes in c#?
Explain the different types of delegates used in c#.
Why is c# used?
What is a helper method in c#?