Advantage between (int) and Convert.ToInt32?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there any advantage, or a recommended preference, between using (int) or
Convert.ToInt32() to convert numeric types to System.Integer32 ?

Thanks,
 
Hi,

They are two different concepts, the first is a cast , for this to work the
casted type should be convertible to int , no all of the types are.

The second are a series of method with different signatures, each overloaded
version perform the needed conversion.

IMO a cast should be faster than calling Convert.XXX but I cannot garantee
it, it does depend of the typed being converted.

cheers,
 
Back
Top