The reason for the error is that you wrote = when you meant == . In c #
string1.Length > 0 & string2.Length = 0
means
(string1.Length > 0) & (string2.Length = 0)
The left side type is bool , and the right side type is int , which cannot be & -ed together, hence the error. Of course, even if you manage to get past this, Length also cannot be the purpose of the destination.
Use == to verify equality. = - destination.
Consider also using && instead of & . The meaning of x & y is to "evaluate both, the result is true if both are true and false otherwise." The value x && y means "evaluate the left side, if it is false , then the result is false , so do not evaluate the right side. If the left side is true , then act as & ."
source share