What is the Difference between read only and constant
variables?

Answer Posted / parmjit

We can assign a value to a readonly variable at runtime
till it is a unassined identifier, but once value is
assigned, it cannot be changed.

In case of const we cannot assign a value at run time i.e.
the value assigned to it at declaration time cannot be
change

Is This Answer Correct ?    39 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the uses of namespaces?

603


Is is possible to force garbage collector to run?

523


What does mean before a string in c#?

518


Name any three ways to pass parameters to a method in c#?

488


Is stringbuilder faster than string concatenation c#?

446






What is a multicast delegate in c#?

533


What is binary search tree in data structure?

479


Is c# code is managed or unmanaged code?

489


Define MSIL, and how does it works? Why our developers need an appreciation of it if at all?

506


Explain the Abstract class in c#.net

553


What is icomparer in c#?

490


What is lazy in c#?

513


Explain about CTS?

549


Is c# or c++ better for games?

466


What is escape sequence in c#?

597