Search code examples
arraysvb.netconstantsshared

Constant Shared array in vb.net


Is there a way to create a constant shared array? The ovbious way :

Shared Const GX() As String = {"GS", "GP"}

Is not working, it says you can't use shared and const together.

If you use only const it says you can't declare a contant array in a class.

Thanks in advance


Solution

  • I don't think it's possible. An alternative would be to use ReadOnly

    Public Shared ReadOnly GX() As String = {"GS", "GP"}