C#使用“?”如果else语句设置值,这叫什么 [英] C# using "?" if else statements to set value whats this called
本文介绍了C#使用“?”如果else语句设置值,这叫什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嘿,我刚遇到以下语句
return name != null ? name : "NA";
我只是想知道在.NET中这是什么称呼
I am just wondering what this is called in .NET
是吗?代表ie,然后执行此操作...?
does the ? stand for i.e. then do this... ?
推荐答案
这是条件运算符,通常称为 三元运算符
It's a "conditional operator" commonly known as the Ternary operator
已找到
这篇关于C#使用“?”如果else语句设置值,这叫什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文