different between Const variable and ReadOnly variable

M

Melson

Hi

Does anyone know the difference between Const variable and ReadOnly
variable.

Const Var1 = "123"
Shared ReadOnly Var2 = "123"
 
A

Armin Zingler

Melson said:
Hi

Does anyone know the difference between Const variable and ReadOnly
variable.

Const Var1 = "123"
Shared ReadOnly Var2 = "123"

Var1 value is defined at compile time. Var2 is assigned at runtime.

This can not be done with consts:

Shared ReadOnly Var2 As String

Shared Sub New()
Var2 = Now.ToString
End Sub


Armin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top