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 the difference between dynamic and var in c#?
Can a class have static constructor?
Is array value type in c#?
What is xamarin used for?
How can I access the registry from c# code?
What is difference between ienumerable and list?
What are the classes contained in a single .NET DLL ?
What is difference between array and arraylist c#?
What is variable in c#?
Is array ienumerable c#?
How do you serialize in c#?
Is comparable a functional interface?
Explain the three services model (three-tier application). Presentation (ui), business (logic and underlying code) and data (from storage or other sources).
what is a enumeration in c#
How do you achieve polymorphism in c#?