What to do - do as an operator in C #

I have researched this extensively, but cannot find anything in this regard.

If I were to use the if statement as a check and you had to write something along these lines:

if(split[lengthsplit + 1] == "=" && split[lengthsplit - 1] == "=") 

Can I write above, as shown below, with the same result:

 if(split[lengthsplit +- 1] == "=") 

I don’t see the result of this and am wondering if he will add 1 in this case and remove it, or if he tries both scenarios first to give the opportunity to compress the validation to get rid of Boolean operators to some extent.

If so, maybe I could use split [lengthsplit + -] instead?

+5
source share
3 answers

Can I write the above result with the same result

No, you cannot, because this lengthsplit +- 1 translates to lengthsplit + (-1) , because - here it is considered a unary operator (and unary operators have higher priority than binary + ).

+4
source

lengthsplit +- 1 is lengthsplit + (-1) in "C #"

no operator "- +" or "+ -",
+1
source

No +- operator. The example you provided is a great example of how not to use spaces. If something + cancels.

0
source

All Articles