问号和冒号在声明中是什么意思?这是什么意思? [英] Question mark and colon mean in statement? what does it mean?

查看:133
本文介绍了问号和冒号在声明中是什么意思?这是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么的?和结肠的意思吗?

 ((OperationURL [1] ==GET)GetRequestSignature():)

在下面的语句...

 字符串requestUri = _apiURL + + OperationURL [0] +((OperationURL [1] ==GET)GetRequestSignature()?)的E =?;


解决方案

这是条件运算符前pression。

 (条件)? [真实路径]:[虚假路径]

例如

 字符串值= someBooleanEx pression? 阿尔法:测试版;

因此​​,如果布尔前pression是真实的,价值将举行阿尔法,否则,它拥有测试版。

有关常见的错误,人们陷入,请参见这个问题 C#标签维基

What does the ? and colon mean?

 ((OperationURL[1] == "GET") ? GetRequestSignature() : "")

In the following statement...

string requestUri = _apiURL + "?e=" + OperationURL[0] + ((OperationURL[1] == "GET") ? GetRequestSignature() : "");

解决方案

This is the conditional operator expression.

(condition) ? [true path] : [false path];

For example

 string value = someBooleanExpression ? "Alpha" : "Beta";

So if the boolean expression is true, value will hold "Alpha", otherwise, it holds "Beta".

For a common pitfall that people fall into, see this question in the C# tag wiki.

这篇关于问号和冒号在声明中是什么意思?这是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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