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")}

最新文章

  1. [C#] 简单的 Helper 封装 -- SecurityHelper 安全助手:封装加密算法(MD5、SHA、HMAC、DES、RSA)
  2. 半连通分量--Tarjan/Kosaraju算法
  3. Serializable 序列化
  4. 判断手机,pc方式登录
  5. 用xshell操作linux系统的常用命令
  6. [Java] JSTL格式化时间计算时差
  7. 剖析iphone之触摸事件touchstart
  8. AFNetworking自我总结
  9. 【转载】基于vw等viewport视区相对单位的响应式排版和布局
  10. 有序的Map集合--LinkedHashMap
  11. openstack项目【day23】:KVM介绍
  12. WebDriver高级应用实例(8)
  13. psutil库
  14. CDH5.11安装spark2.x详细步骤
  15. 密码记录工具keepass保存密码
  16. vue使用过程中的一些小技巧
  17. DICOM中的入门概念
  18. IntelliJ IDEA 插件开发视频教程
  19. idea 编辑时cup飙升解决方案,亲测有效
  20. BZOJ 1316: 树上的询问

热门文章

  1. for循环经典案例
  2. oracle管理控制台不能打开,提示此网站的安全证书有问题?
  3. Arrays.toString Arrays.asList
  4. Visual Studio 2010扩展让JS与CSS实现折叠
  5. python : dictionary changed size during iteration
  6. Protocol and Delegate
  7. UITableViewCell 设置圆角
  8. 关于Xib 需要注意的地方
  9. Altium designer 小技巧
  10. JavaScript:日期选择器组件的使用