Difference Between ReadOnly and Constant Variable in
compile time and Run Time.
Answers were Sorted based on User's Feedback
Answer / karna
I am adding another point to the above answer.
as the constant variable is constant over the class,that
means,all the objects created for that class have the same
value.
but in case of readonly variables,we can assign different
values in the different instances of the class it contains.
Is This Answer Correct ? | 6 Yes | 0 No |
Answer / kamlesh sharma
readonly variables are can be initilized at compile time
but we can assign values to readonly varialble at once
through functions or constructors
but in case of constant variables once assign a value we
can't change value and must assign value to constant
variables at the time of declarition
Is This Answer Correct ? | 5 Yes | 1 No |
Answer / saiish bhat
readonly is compile time constant.
constant is runtime constant.
constatnt field is used to initialize at the declaration of
the field.
readonly field is used at the declaration or constructor of
the field.
Is This Answer Correct ? | 0 Yes | 5 No |
What is difference between view and partial view?
What was the difference between machine.config and web.config files
17 Answers Assurgent, NIIT, TCS,
What is the Web.config file used for? a) To store the global information and variable definition for the application. b) Configures the time that the server-side codebehind module is called c) To Configure the Web Server. d) To Configure the Web browser.
8 Answers HCL, IBM, Syntax Softtech, Vypin, WideVision Technologies,
If we add a textbox and give the required field validator,and i add two radio buttons 1 is yes another one is No.And i add another one server control button ,if i click the button ,if the radio button Yes is checked the validation control is fired ,if no the validation control is not fired.So what you used to solve this problem.
Are cookies client side or server side?
what is diffrence between debug class and trace class in asp.net ?
differences between class inheritance and interface?
Is it possible to create web application with both webforms and mvc?
Define view state.
diffrance between stored procedure & function in sql server?
What are the advantages and disadvantages of session?
What is the Difference B/W Finalize() and Dispose() in .Net?
12 Answers HCL, IBM,