Re: type case

From: Jon Skeet [C# MVP] (skeet_at_pobox.com)
Date: 05/27/04

  • Next message: Joey: "Re: NTFS Folder Permissions"
    Date: Thu, 27 May 2004 09:33:39 +0100
    
    

    cfyam <cfyam@mail.apol.com.tw.NOSPAN> wrote:
    > What's the difference between the "Convert.Int32(XXX)" and "(int)XXX"?

    Convert.ToInt32 can take various types, including string, in which case
    it parses the string. It will also always detect overflows. Casting
    only works if the "source" type has an explicit or implicit conversion
    operator to int.

    Casting will generally be faster where it's available.

    -- 
    Jon Skeet - <skeet@pobox.com>
    http://www.pobox.com/~skeet
    If replying to the group, please do not mail me too
    

  • Next message: Joey: "Re: NTFS Folder Permissions"

    Relevant Pages

    • Re: select case does not work ... why?
      ... This is probably a casting issue in that notification_type 3 is not a string or is "03" or some such variation. ... > select case param ... I believe the colon is used to separate two statements on the same line. ...
      (microsoft.public.scripting.vbscript)
    • TALENT MANAGEMENT tables - (obscenely long)
      ... CASTING DIRECTORS, CASTING STUDIOS, MANAGERS and OTHER_PEOPLE seems to make ... breakdown_id the unique ID used to reference this breakdown. ... title (string) the title of the breakdown. ... >Assistants, Casting Directors, Casting Assistants, Directors, Producers, ...
      (microsoft.public.access.tablesdbdesign)
    • Re: Webservice Dataset Type Fidelity Hoo Hah!!
      ... In a news message it is not so easy reading and therefore I assumed you ... where missing what is casting. ... > Hi Cor ... >> string connection). ...
      (microsoft.public.dotnet.general)
    • Re: Huge string arrays in C#
      ... > in addition, string is a reference type, not a value type, so the casting ... There is no cast to assign a string to an object variable, ...
      (microsoft.public.dotnet.framework.performance)
    • Re: Huge string arrays in C#
      ... >> in addition, string is a reference type, not a value type, so the casting ... > cast an object to some class with several ancestors between it and the ...
      (microsoft.public.dotnet.framework.performance)