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 remote data?
What is the difference between a private assembly and a shared assembly?
What is static variable in c#?
What is a private method in c#?
What does it mean to override a method?
What are the collections in c#?
Is c# different than c++?
What is different between Static Constructor and Private Constructor?
What language is c# similar to?
Can you instantiate an abstract class c#?
How objects are stored in memory?
What is a concrete class in c#?
What is private void in c#?
How do I register my code for use by classic com clients?
Do loops in c#?