标签:io ar sp on bs line res 学习 type
implicit
explicit
float f=12123456.213F
int a = Convert.ToInt32(f); //throw exception or
int a = (int)f; // not throw exception nut got an overflow value
parse and tryparse
string to other datatype
string a="100fh";
int num=int.Parse(a); //throw exception
int result=0;
bool isNum=int.TryParse(num,out result);
if(isNum){ Console.WriteLine(result);
}else{
Console.WriteLine("Invalid")}
【你吐吧c#每日学习】11.10 C# Data Type conversion
标签:io ar sp on bs line res 学习 type
原文地址:http://www.cnblogs.com/jin-wen-xin/p/4087879.html