• +91 9723535972
  • info@interviewmaterial.com

VB.Net Interview Questions and Answers

Question -  What's the difference between const and readonly?

Answer -   The readonly keyword is different 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, 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;

Comment(S)

Show all Coment

Leave a Comment




NCERT Solutions

 

Share your email for latest updates

Name:
Email:

Our partners