gpt4 book ai didi

c# - 为什么同时使用前缀和后缀是非法的?

转载 作者:行者123 更新时间:2023-11-30 18:49:41 25 4
gpt4 key购买 nike

<分区>

为什么下面的代码是非法的?

using System;

class Program
{
static void Main(string[] args) {
int i = 0;
--i++;
Console.WriteLine(i);
}
}

它在 --i++ 上给我以下错误:

The operand of an increment or decrement operator must be a variable, property or indexer

我知道这段代码没有实际用处;我只是好奇为什么不允许这样做。我不在乎它可以通过删除那条线而没有其他影响来修复。因为这是用 标记的, 请包括语言规范中的证据。

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