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
What is the difference between method overriding and method overloading?
What is strong data type in c#?
Name any three ways to pass parameters to a method in c#?
How many bytes is a char c#?
Structs are not reference types. Can structs have constructors?
How to get the sum of last 3 items in a list using lambda expressions?
What is the difference between null and string empty in c#?
Does c# provide copy constructor?
Why do we write system in c#?
How do you sort a list in c#?
Can we use "this" command within a static method?
What is the root element of an xml file?
What is the difference between // comments, /* */ comments and /// comments?
Define acid rule of thumb for transactions in c#.
What is the difference between integer and double?