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 form feed in c#?
Name some properties of thread class.
What is dll hell, and how does .net solve it?
What is a generic class?
What are the advantages of constructor?
What is an icollection in c#?
Explain About web methods and its various attributes
What is the best dependency injection c#?
Is it possible to restrict the scope of a field/method of a class to the classes in the same namespace?
Okay, so an int is a value type, and a class is a reference type. How can int be derived from object?
What is managed code?
What is the difference between ref and out parameters in c#?
How can I check the type of an object at runtime?
How do you achieve polymorphism in c#?
1. Describe page life cycle?