( ! ) Warning: include(): http:// wrapper is disabled in the server configuration by allow_url_include=0 in D:\www\up\CSharp\base04.php on line 20
Call Stack
#TimeMemoryFunctionLocation
10.0000355048{main}( )...\base04.php:0

( ! ) Warning: include(http://pub.houheaven.com/Nav02/Nav_deep2.htm): failed to open stream: no suitable wrapper could be found in D:\www\up\CSharp\base04.php on line 20
Call Stack
#TimeMemoryFunctionLocation
10.0000355048{main}( )...\base04.php:0

( ! ) Warning: include(): Failed opening 'http://pub.houheaven.com/Nav02/Nav_deep2.htm' for inclusion (include_path='.;C:\php\pear') in D:\www\up\CSharp\base04.php on line 20
Call Stack
#TimeMemoryFunctionLocation
10.0000355048{main}( )...\base04.php:0

① 显式转换

使用:(数据类型名称)Data

说明:显式转换又叫强制转换。

实例:打开

float x=5.15f;

int y=(int)x;

② 隐式转换

说明:隐式转换的一般规律是“变大、变准确”,这就意味着占用空间小的数值型数据类型可以直接转换为占用空间大的类型,比如一个算术运算中,一个操作数为int,一个为float,那么这个int类型的数据会自动转换为float类型,得到的结果也是float。

③ Convert 类

 方法功能说明应用实例实例结果
01Convert.ToString(any)任何→字符串Convert.ToString(123)"123"
02Convert.ToBoolean(Num)数字→布尔Convert.ToString(123)true
03Convert.ToChar(Int)整数→字符Convert.ToString(65)A
显示框架
显示框架
显示框架
显示框架