hi all,

I want to do and (&) operator betwneen 2 string, 2 number, 2binary
and there is an error displayed when i do that, the error is:

operator & cannot be applied to operands of type string and string (binary and binary),
(integer and integer),
How I can Solve this Problem???

Thanks All,,,

Recommended Answers

All 2 Replies

Hi,
You cannot apply & (Logical AND) operator over strings. IF apply what the result you would expect?

but it can be applicable to integers.
Ex

int iInt = 10;
 if ((iInt & 10) == 10)
     MessageBox.Show("(iInt & 10) == 10 is True");

What the...?! Logical AND is a CPU operator that flips bits, how could you possibly do that to a System::String object?

You're looking for either a System::Text::RegularExpressions::Regex or &&.

In C this would "work" in that you'd compare bits in the pointer, but in C# you don't have direct access to memory so it's not "legal" and the compiler won't let you even try.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.