What is the difference b/w Readonly Variable and Constant
Variable?
Answer Posted / niranjan
The readonly keyword differs from the const keyword. A
const field can only be initialized at the declaration of
the field. A readonly field can be initialized either at
the declaration or in a constructor. Therefore, readonly
fields can have different values depending on the
constructor used. Also, although a const field is a compile-
time constant, the readonly field can be used for run-time
constants, as in this line: public static readonly uint l1
= (uint)DateTime.Now.Ticks;
| Is This Answer Correct ? | 4 Yes | 0 No |
Post New Answer View All Answers
What is datatype conversion?
List the types of generations in garbage collector?
Tell me which namespace are used for accessing the data?
What is sealed class?
What do you understand by vb.net?
What is sorting in vb?
Which classes a dll can contain?
So you know which dll is used for microsoft .net run time?
what is difference between web.config and machine.config and where it will be ?
What is the difference between static or dynamic assemblies?
Explain the difference between vb.net and c#, related to oops concepts?
Did vb6 support multi-threading ?
Which control is an example of an object in vb net?
What are the types of generations in garbage collector?
How to send xml file on server using http protocol?