double dnum = 100.1;
int ifromd = (int)dnum; //double类型显式转换转为int类型
Class1 c11 = new Class1();
Class2 c22 = c11 as Class2; //使用as进行显式转换
Console.WriteLine(c22 is Class1);
Console.WriteLine(c22 is Class2);
运行结果:
FALSE
FALSE//????Why this is false
double dnum = 100.1;
int ifromd = (int)dnum; //double类型显式转换转为int类型
Class1 c11 = new Class1();
Class2 c22 = c11 as Class2; //使用as进行显式转换
Console.WriteLine(c22 is Class1);
Console.WriteLine(c22 is Class2);
运行结果:
FALSE
FALSE//????Why this is false
本文标题:显示转换和隐式转换
本文链接:https://www.haomeiwen.com/subject/vytofxtx.html
网友评论