Results 1 to 3 of 3

Thread: Simple Question

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2002
    Posts
    382

    Simple Question

    Can anyone tell me the difference between these two lines of code?

    Code:
                Dim sBuff As Byte() = Encoding.ASCII.GetBytes(Msg)
                Dim sBuff() As Byte = Encoding.ASCII.GetBytes(Msg)
    I'm sure there is some difference even though they perform exactely the same. Just one of those little nags that get me because I can't seem to find the answer in the MSDN Library.

  2. #2
    Frenzied Member dynamic_sysop's Avatar
    Join Date
    Jun 2003
    Location
    Ashby, Leicestershire.
    Posts
    1,142
    you can't specify array bounds on the first one.
    eg:
    VB Code:
    1. Dim strBuff As Byte([u]100[/u]) [COLOR=green]'/// this won't work
    2. [/COLOR]
    3.  
    4. Dim strBuff(100) As Byte[COLOR=green]'/// this will work
    5. [/COLOR]
    ~
    if a post is resolved, please mark it as [Resolved]
    protected string get_Signature(){return Censored;}
    [vbcode][php] please use code tags when posting any code [/php][/vbcode]

  3. #3
    yay gay PT Exorcist's Avatar
    Join Date
    Apr 2002
    Location
    . . . my reason of shame
    Posts
    2,729
    In the first one you are just instanciating a byte variable. In the second one you are creating a variable holder for an array of bytes.
    \m/\m/

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width