Whats the difference between const and readonly?
Submitted by: AdministratorThe 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;
Submitted by: Administrator
public static readonly uint l1 = (uint) DateTime.Now.Ticks;
Submitted by: Administrator
Read Online VB .Net Job Interview Questions And Answers
Top VB .Net Questions
☺ | What is difference between import System.Data.SqlClient,System.Data.Oledb? |
☺ | What does it meant to say "the canonical" form of XML? |
☺ | Differences between VB.Net and C#, related to OOPS concepts |
☺ | How to store and retrieve images in SQL server database through VB.NET? |
☺ | Which is the tool which can convert Visual basic old version to .NET compatibility version? |
Top Dot Net Technologies Categories
☺ | MSF Interview Questions. |
☺ | .Net Architecture Interview Questions. |
☺ | ASP.Net MVC Interview Questions. |
☺ | Entity Framework Interview Questions. |
☺ | C# (Sharp) Programming Language Interview Questions. |