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 is difference between property and variable in c#?
What are the steps to create a webservice and consume it?
What is the difference between Decorator and Adapter pattern?
What is field in c#?
what is object-oriented programming (oop) language?
What is gridview c#?
What is arraylist?
What is sorting in c#?
What is literal in c#?
Is c# 8 released?
In howmany ways can you deploy an assembly?
What are the properties of a string class?
What is visual c# net?
C# called c sharp why?
What is datatable in c#?