Whats the Diff?

  • Thread starter Thread starter Sueffel
  • Start date Start date
S

Sueffel

What is the difference between these two statements?

Dim OutData() as Byte
Dim OutData as [Byte]()

I'm not seeing it...

--
Thanks
Sueffel
 
Sueffel said:
What is the difference between these two statements?

Dim OutData() as Byte
Dim OutData as [Byte]()

I'm not seeing it...

In the first line, the brackets are after "OutData", in the second line
after "[Byte]".

..... oh .... you mean the different meanings? ;-) There is no difference.
Both are equal. BTW, you don't need the "[" and "]".
 
Sueffel,
There is no difference, they both declare an array of bytes.

The [] in the second one is used to escape an identifier allowing you to use
a keyword for an identifier. Seeing as the Byte identifier is the same as
the Byte keyword, both are used to refer to the System.Byte type there is no
reason to escape it. Where you need to use [] is when you are using a
keyword to refer to an identifier and that keyword is not valid in that
context, such as Enum.

If [Enum].IsDefined(GetType(MyEnum), myValue) Then

The () in both cases says you have an array. Whether you include the () on
the identifier or the type is a matter of preference I normally include it
on the identifier, unless I have to include it on the type (such as the
return value of a property or function.

Hope this helps
Jay
 
What is the difference between these two statements?

Dim OutData() as Byte
Dim OutData as [Byte]()

I'm not seeing it...

--
Thanks
Sueffel

I was wondering becuse I saw some sample code that had that decleration, and I wasn't sure if it was more efficient on speed or memory. Thank you for the clarification, I can go back to what I'm used to , dim OutData() as Byte and be happy!

Thanks again everyone,
Sueffel
 
Back
Top