why this expression is invalid?

hi

when i write
Dim buff As Byte() = New Byte(fsin.Length)

it says that byte has no contructors

and when i put square brackets at the end like that

Dim buff As Byte() = New Byte(fsin.Length) {}

no complain

any explain for this

thanks in advance.



Answer this question

why this expression is invalid?

  • Ram v

    Dim Buff(fsin.Length-1) as byte

    Byte does not have a constructor, it is a value type and not a reference type like a label or Dictionary.
    One does not use New on value types.



  • eran

    Usually that implies an initialization Array. For example, you may see this at times:

    Dim S() as bye = {1,2,3}

    That will create a three byte array and fill in the values 1,2,3



  • Wilton Kwok

    thanks for reply

    but i write new byte and at the end of the second expression i put square brackets{} what is that mean is this mean that that now they are not constructors

    thanks in advance.


  • why this expression is invalid?