12.4 How do I convert a string to a double or int? What plays the role of atof and atoi in C#?


You use static members of the Convert class found in the System namespace to handle conversions in the .NET framework.

     string s = "45";
     int h = Convert.ToInt32(s);
     double d = Convert.ToDouble(s);

© 2001-2010 Copyright Syncfusion Inc. All rights reserved.  |  Privacy Policy  |  Contact  |  Sitemap