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
What is difference between list and dictionary in c#?
What are winforms in c#?
What is the use of convert toint32 in c#?
How C# 4.0 supports dynamic programming language?
What is the role of the datareader class in ado.net connections?
Why main is static in c#?
What is COM Interoperability?
What is different between Implicit conversion and Explicit conversion in C#?
how encapsulation is implemented in c#
What is string interpolation in c#?
How do I join one form to another in c#?
Does c# support const methods, properties, or events?
What do you mean by “finalize” and “finally” methods in c#?
How do you implement thread synchronization in c#?
Explain about Oops concept