CS0019 Operator cannot be applied to operands of type 'bool' and 'int'

后端 未结 3 1074
臣服心动
臣服心动 2021-01-02 20:24

This program is in response to the assignment:

\"Create a method named Sum() that accepts any number of integer parameters and displays their sum. Writ

3条回答
  •  感动是毒
    2021-01-02 21:12

    You can't write (q == 1) in C#, because q is a bool and 1 is an int.

    q can only be compared to another boolean expression, e.g. true, false, another boolean variable, etc.

提交回复
热议问题