Problems in declaring a variable as Byte in VB.NET
Some flavors
Dim b() As Byte 'b is nothing
Dim b1(1023) As Byte 'b1 is an array of 1024 elements, all equal to 0
Dim b2() As Byte = New Byte() {85, 99, 1, 255} 'four elements
b = New Byte() {} 'zero element array
b = New Byte() {1, 2} 'two element array
Inference is generally a bad idea.
You need curly braces, because if you don't put them, it means you're trying to call a constructor for a single object -- which is an error for different reasons:
- You can't assign a single object to an array. (This is always true.)
Byte
doesn't have a constructor. (This is only true in this particular case.)