what is difference between const, static and readonly?
Answers were Sorted based on User's Feedback
Answer / magesh
const variable : const can never be modified and
must be initialized to a compile time constant.
Static variable : you received last updated value, when u
getting value for static variable.
Readonly variable : The readonly variable can be changed
inside the constructor.
Is This Answer Correct ? | 7 Yes | 0 No |
Answer / amit manekar
The difference is that static read-only can be modified by
the containing class, but const can never be modified and
must be initialized to a compile time constant. To expand on
the static read-only case a bit, the containing class can
only modify it:
in the variable declaration (through a variable initializer).
in the static constructor (instance constructors if it's not
static).
Is This Answer Correct ? | 2 Yes | 1 No |
Why is it preferred to not use finalize for clean up?
Explain how server control validation controls works?
2 Answers CMS, Syntax Softtech,
What are sql notifications and sql invalidations?
What are standard controls?
What is the difference between HTTP-Post and HTTP-Get ?
Why do we use datasource in asp.net?
How does exception management works in ASP.NET?
What is variable and constant in .net programming language?
What is boxing? How we can use it?
Is it possible to prevent a browser from caching an ASPX page?
How .Net has implemented security for web applications?
What is difference cookie and session?