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 are the Application_Start and Session_Start subroutines used for?
hi .net gurus. plz if any one has dumps on 70-631 and 70-541 on windows sharepoint services kindly mail me.
How to use a Master Database in Asp.net?
How can you register a custom server control to a web page?
What is the procedure to handle the process request using mhpm events fired? : asp.net mvc
can i use two web.config files of ConnectionString in One Default.aspx page
6 Answers Satyam, Verinon Technology Solutions, Wipro,
How long do session variables last?
When an ASP.NET server control is added to a web form, Visual Studio .NET adds one item to the class for the form. What item is added? a) The event registration. b) A protected class member for the control. c) A default event handler for the click event. d) A default class that inherits from the control?s base class.
4 Answers Syntax Softtech, TCS,
What is xaml? Are xaml file compiled or built on runtime?
What are the different validators in asp.net?
Describe paging in asp.net?
User contro having 4 text boxes given validation controls. i want to execute validations after the button click event how it is?
Visual Basic (800)
C Sharp (3816)
ASP.NET (3180)
VB.NET (461)
COM+ (79)
ADO.NET (717)
IIS (369)
MTS (11)
Crystal Reports (81)
BizTalk (89)
Dot Net (2435)
Exchange Server (362)
SharePoint (720)
WCF (340)
MS Office Microsoft (6963)
LINQ Language-Integrated Query (317)
WPF (371)
TypeScript (144)
Microsoft Related AllOther (311)