Answer Posted / xiaof
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, while a const field is a compile-
time constant, the readonly field can be used for runtime
constants as in the following example:
public static readonly uint l1 = (uint) DateTime.Now.Ticks;
Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
Can you inherit from a sealed class?
Can you drink alcohol with a loop recorder?
What is a multicast delegate in c#?
Why singleton class is sealed?
What is parallel foreach c#?
Any problem found in vs.et
Is c# and c sharp same?
What is array collection?
Explain polymorphism in c# with a simple example?
Is post back in c#?
Explain the difference between user control and custom control. Also, explain their use.
Why do we use public static void main in c#?
What is difference between function and method in c#?
Why are c# strings immutable?
Give examples for reference types?