vb.net中的Directcast [英] directcast in vb.net

查看:113
本文介绍了vb.net中的Directcast的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是直播,在什么情况下我们使用此

what is directcast and in what kind of situation we use this

推荐答案

下面的链接将为您提供帮助.

DirectCast与CType [
Below link will help you.

DirectCast vs. CType[^]


尝试
MSDN- [DirectCast] [ DirectCast与TryCast之间的区别 [
Try
MSDN-[DirectCast][^]
Difference Between DirectCast and TryCast[^]


DirectCast用于将对象从一种数据类型转换为另一种数据类型.您可以使用与CType关键字相同的方式来使用它.

这两个关键字之间的区别是,只要在表达式和类型之间定义了有效的转换,CType就会成功,而DirectCast要求对象变量的运行时类型必须与指定的类型相同. >
但是,DirectCast的运行时性能优于CType.
The DirectCast is used to casting objects from one datatype to another. You use it the same way you use the CType keyword.

The difference between the two keywords is that CType succeeds as long as there is a valid conversion defined between the expression and the type, whereas DirectCast requires the run-time type of an object variable to be the same as the specified type.

however, the run-time performance of DirectCast is better than that of CType.


这篇关于vb.net中的Directcast的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆