Convert.ToInt or String.Split : which is more efficient?

Posted by zsharp on Stack Overflow See other posts from Stack Overflow or by zsharp
Published on 2010-03-24T19:12:43Z Indexed on 2010/03/24 19:23 UTC
Read the original article Hit count: 263

Filed under:
|
|
|

Which way is better for removing float decimals places or is there a more efficient way?

Rounding is not important, i am interested in displaying the number

      Float number;            
      1- int wholeNumber= Convert.ToInt(number);
         string display=wholeNumber.ToString();

      2- string [] splitNumber= number.ToString().Split('.');
         string display=splitNumber[0];

© Stack Overflow or respective owner

Related posts about c#

Related posts about float