Home » VB.NetRSS

It is possible to declare an array as constant

Hi,

I try to convert a Java Projekt in vb.

 

Can I declare in vb an array as constant.

 

The Java code looks like this

 final byte[] tmp=new byte[4];

What I did, was:

Const tmp(3) As Byte

What is wrong with that?

 

2 Answers Found

 

Answer 1

static readonly tmp(3) as byte

Adam

 

Answer 2

static readonly tmp(3) as byte


Another .NET approach would also be to declare  an enumeration.  This is the more OOP approach than a global array.

Public Enum MyByteConstants As Byte
  First = 1
  Second = 2
  Third = 4
  Fourth = 8
End Enum

You can also add the Flags atrribute, too.

Rudy  =8^D

 
 
 

<< Previous      Next >>


Microsoft   |   Windows   |   Visual Studio   |   Follow us on Twitter