What is the Difference between read only and constant
variables?
Answer Posted / akshay
Constants :
* Constant value. Cannot be changed once initialized.
Should be Initialize the value where it declared.
* Const value fully evaluated at compile time
* By default static
* Possible to declare within function
Readonly :
* Could be declare as Static or Non Static
* Assign the value where it declared or can be assigned in
constructor
* Could not declare within function
* can be initialized in compile time or in runtime.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Is arraylist faster than linkedlist?
Is null c# operator?
Can mvc be used for desktop applications?
Can constructor be protected in c#?
Is string passed by reference in c#?
What are the string functions in c#?
What are the return types in c#?
Is xamarin free?
What is difference between an reference type and value type in C#?
Which are the loop types available in c#?
What is array formula?
What is dao in c#?
How do I run managed code in a process?
What are anonymous functions in c#?
Do extension methods have to be static?