Answer Posted / vathsala
A quick synopsis on the differences between 'const'
and 'readonly' in C#:
'const':
1.Can't be static.
2.Value is evaluated at compile time.
3.Initiailized at declaration only.
'readonly':
1.Can be either instance-level or static.
2.Value is evaluated at run time.
3.Can be initialized in declaration or by code in the
constructor.
| Is This Answer Correct ? | 3 Yes | 0 No |
Post New Answer View All Answers
Explain the difference between a struct and a class?
What is a template class?
Explain the types of assemblies in .net?
What is assembly c#?
How does the lifecycle of Windows services differ from Standard EXE?
Can abstract classes be final?
What is difference between new and override in c#?
Why do you need boxing in c#?
Is predicate a functional interface?
What is lazy t?
What language is arduino?
What is the difference between finalize() and dispose() methods?
What is difference between c sharp and c#?
What does void mean unity?
Does hashset allow duplicates c#?