Java vs. C#

Converting a string to a number


Java
 
String s = "123.45";
int i = new Double(s).intValue(); //123
int i2 = (int)new Double(s).doubleValue(); //123

C#
 
string s = "123.45";
int i = (int)s.ToSingle();// 123
int i2 = s.ToInt16(); // 123