What is the difference b/w constant & read only variable?
Answer Posted / maloy.adhikari
Constants: The value can't be changed
Read-only: The value will be initialized only once from the
constructor of the class.
Const:
1)Can not be static.
2)The value is evaluated at compile time.
3)It is initialized at declaration only.
4)the const keyword is used for compile-time constants
Readonly:
1)Can be either instance-level or static.
2)The value is evaluated at run time.
3)It can be initialized in declaration or by code in the
constructor. Therefore, readonly fields can have different
values depending on the constructor used.
4)the readonly keyword is used for runtime constants.
Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
Explain the methods used to render the views in mvc?
How route table has been created in asp.net mvc?
What is filters in web api?
What is poco proxy? : Entity framework
How do I install .net framework?
How to change the action name in ASP.Net MVC?
Explain .Net Framework? Why we use it?
What is the domain object?
Do you know about the new features in asp.net mvc 4 (asp.net mvc4)?
What are the versions of .net framework?
i just want to write an exam regarding .net?plz give me information about taking a test?where to pay 4 d exam,exam centre?
Explain linq to entities? : Entity framework
Is .net core faster than .net framework?
What is partialview in asp.net mvc?
I have 2+ years of fake experience,actually i could not answer for project questions..?how can i answer please suggest me..?