PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197
VS 2008 Dim A() As Integer vs Dim A As integer() ?? Noob question-VBForums
Results 1 to 3 of 3

Thread: Dim A() As Integer vs Dim A As integer() ?? Noob question

  1. #1

    Thread Starter
    Member
    Join Date
    Mar 2012
    Posts
    49

    Dim A() As Integer vs Dim A As integer() ?? Noob question

    Can somebody explain the second one to me? I'm not clear on the concept.
    The first one I know is an array of integers. but what about the second one?

  2. #2
    Master Of Orion ForumAccount's Avatar
    Join Date
    Jan 2009
    Location
    Canada
    Posts
    2,802

    Re: Dim A() As Integer vs Dim A As integer() ?? Noob question

    There is no difference, both will be an Integer array. However, if you are initializing an array with specific dimensions, you must use the first method.

  3. #3
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    5,681

    Re: Dim A() As Integer vs Dim A As integer() ?? Noob question

    The first method is a throw-back to the old days of basic. Consistently the type would be represented in the .Net framework as Integer(). As such this is valid:-
    vbnet Code:
    1. If TypeOf x Is Integer() Then Stop
    If there is some exception thrown that has to do with type you would see Integer[] which is basically the same thing.

    ForumAccount is right though, they are just two ways of doing the exact same thing.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena


    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. -jmcilhinney

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width