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
Can you please explain the difference between namespace and assembly?
What is the significance of delegates?
What is meant by jagged arrays?
What is sorting in vb?
What is a stream in vb.net?
What is the advantage of using system.text.stringbuilder over system.string?
what is difference between web.config and machine.config and where it will be ?
Define clr?
Explain about branching logic control in vb.net?
What is pre-jit?
Why should you use delegate?
What is the difference between c# and vb.net?
What is the use of console application?
What is sealed class?
Explain how does the xmlserializer work?