VB.NET中的合并运算符和条件运算符 [英] Coalesce operator and Conditional operator in VB.NET

查看:116
本文介绍了VB.NET中的合并运算符和条件运算符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:
VB.NET中是否有条件三元运算符?

Possible Duplicate:
Is there a conditional ternary operator in VB.NET?

大家好, 是否可以像在C#中那样在VB.NET中使用Coalesce运算符(??)和条件三元运算符(:)?

Hi guys, Can we use Coalesce operator(??) and conditional ternary operator(:) in VB.NET as in C#?

推荐答案

我认为使用内联if语句可以使您接近:

I think you can get close with using an inline if statement:

//C#
int x = a ? b : c;

'VB.Net
Dim x as Integer = If(a, b, c)

这篇关于VB.NET中的合并运算符和条件运算符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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