什么是C#的VB.NET等效项“是”?关键词? [英] What is the VB.NET equivalent of the C# "is" keyword?
本文介绍了什么是C#的VB.NET等效项“是”?关键词?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要检查给定对象是否实现了接口。在C#中,我只是说:
I need to check if a given object implements an interface. In C# I would simply say:
if (x is IFoo) { }
正在使用 TryCast()
,然后检查 Nothing
最佳方法?
Is using a TryCast()
and then checking for Nothing
the best way?
推荐答案
尝试以下操作
if TypeOf x Is IFoo Then
...
这篇关于什么是C#的VB.NET等效项“是”?关键词?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文