Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. As Any Data Type

As Any Data Type

Scheduled Pinned Locked Moved Visual Basic
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Michael Cocozza
    wrote on last edited by
    #1

    I am searching for insight on the relative benefits / downsides to using the "As Any" data type in VB. My assumption is that CPU cycles are taken in order to resolve the data types at runtime vs. the use of a stronger type declaration, but I have no numbers telling me that is the case. Any insight appreciated Mike

    L K 2 Replies Last reply
    0
    • M Michael Cocozza

      I am searching for insight on the relative benefits / downsides to using the "As Any" data type in VB. My assumption is that CPU cycles are taken in order to resolve the data types at runtime vs. the use of a stronger type declaration, but I have no numbers telling me that is the case. Any insight appreciated Mike

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      API calls probably don't go much faster when stronly typed.... but, API calls ALWAYS crash if you do it wrong, so strong typing is much better but not because of speed.

      1 Reply Last reply
      0
      • M Michael Cocozza

        I am searching for insight on the relative benefits / downsides to using the "As Any" data type in VB. My assumption is that CPU cycles are taken in order to resolve the data types at runtime vs. the use of a stronger type declaration, but I have no numbers telling me that is the case. Any insight appreciated Mike

        K Offline
        K Offline
        Klaus Probst
        wrote on last edited by
        #3

        I am searching for insight on the relative benefits / downsides to using the "As Any" data type in VB. My assumption is that CPU cycles are taken in order to resolve the data types at runtime vs. the use of a stronger type declaration, but I have no numbers telling me that is the case. Any insight appreciated Au contraire. VB will do no type checking on an "As Any" variable (although it still needs to figure out what it's passing in order to know how to pass it). I don't think you need to worry about CPU cycles here. It's better to worry about how "As Any" will impact your code readability. If you have an API that takes one or more "As Any" arguments, is it always clear what, how and why you are passing what you're passing? As Any is mainly useful for APIs with arguments like lParam in SendMessage that can be basically anything. Always strong type if you can, but avoid the "multiple overloads" mess for an API (like so many people do with SendMessage). ___________ Klaus [www.vbbox.com]

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups