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
What does int parse do in c#?
How many constructors can a class have in c#?
why delegate is type safe?
What is string in c# net?
Give examples for value types?
What is generic delegate in c#?
What is ado c#?
What is the difference between overriding and overloading in systemverilog?
How many types of collections are there in c#?
In dynamic link library, which api is used for load library?
Can derived classes have greater accessibility than their base types?
Is stringbuilder faster than string concatenation c#?
Why we use get and set property in c#?
Why abstract class is not instantiated in c#?
Is friend a constructor?