gpt4 book ai didi

C# 字节类型和文字

转载 作者:行者123 更新时间:2023-11-30 19:57:10 25 4
gpt4 key购买 nike

<分区>

以下代码有效。

byte b = 1;

但是我注意到下面的代码不起作用

byte b = BooleanProperty ? 2 : 3; // error

编译器说

Cannot convert source type 'int' to target type 'byte'

我理解int类型不能隐式转换为byte类型。但为什么前者的代码有效,而后者却不行呢?

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com