Results 1 to 4 of 4

Thread: are these statements the same? [RESOLVED]

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Nov 2003
    Posts
    1,489

    Post are these statements the same? [RESOLVED]

    dim myGraphicsPath as graphicsPath
    myGraphicsPath = new GraphicsPath()


    is this more easily written as...

    dim myGraphicsPath as New GraphicsPath

    ????????????????????????????????

    seems like the same to me anyway.
    Last edited by Andy; Dec 29th, 2003 at 03:10 AM.

  2. #2
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Yes.

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Nov 2003
    Posts
    1,489
    thanks!

  4. #4
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Originally posted by thephantom
    dim myGraphicsPath as graphicsPath
    myGraphicsPath = new GraphicsPath()

    is this more easily written as...

    dim myGraphicsPath as New GraphicsPath

    ????????????????????????????????

    seems like the same to me anyway.
    Well , yes the same but not 100% the same . Consider this :

    VB Code:
    1. dim myGraphicsPath as graphicsPath
    2. myGraphicsPath = new GraphicsPath()
    CLR do this :
    1-Reserve memory for myGraphicsPath and assign it a name .
    2-Here , myGraphicsPath is actually created and filled in the memory allocated and ready to be accessed .


    VB Code:
    1. dim myGraphicsPath as New GraphicsPath
    1-Reserve memory , assigne it a name , and immediately create the object inside it .

    This made some performance problems in previous VB versions but as MS says , it's optimized in .NET .

    Personally , I like one-step declaration .

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