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. Web Development
  3. ASP.NET
  4. what is the difference between

what is the difference between

Scheduled Pinned Locked Moved ASP.NET
questionhelp
3 Posts 2 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.
  • S Offline
    S Offline
    skywen
    wrote on last edited by
    #1

    "(int)parameterItemID.Value" and "Convert.ToInt32(parameterItemID.Value)" can somebody help me? thanks!!

    A 1 Reply Last reply
    0
    • S skywen

      "(int)parameterItemID.Value" and "Convert.ToInt32(parameterItemID.Value)" can somebody help me? thanks!!

      A Offline
      A Offline
      Andrew Quinn AUS
      wrote on last edited by
      #2

      Hi, The first is an explicit conversion (called casting), the other uses a system conversion object. The latter will throw an InvalidCastException if no meaningful conversion can be performed. If you do use the explicit cast, you could find the value outputted of an indeterminate value. You could use the checked C# command to offer some protection but this only throws an OverflowException if the result is out of bounds for the data type. My advice would be to always use Convert.Toxxxx when converting types. Hope this helps, Andy

      S 1 Reply Last reply
      0
      • A Andrew Quinn AUS

        Hi, The first is an explicit conversion (called casting), the other uses a system conversion object. The latter will throw an InvalidCastException if no meaningful conversion can be performed. If you do use the explicit cast, you could find the value outputted of an indeterminate value. You could use the checked C# command to offer some protection but this only throws an OverflowException if the result is out of bounds for the data type. My advice would be to always use Convert.Toxxxx when converting types. Hope this helps, Andy

        S Offline
        S Offline
        skywen
        wrote on last edited by
        #3

        i see. thanks for your advice again.

        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