Sorry for such a ludicrously n00b question... But what is the bitwise 'Not' operator in C#? In short, I'm trying to replicate this VB.Net code in C#:
In C# I tried this:
But the above complains that the '!' operator does not apply for Integers. I guess it's for booleans only? So what is the easiest way to do this in C#? I can't imagine that I have to resort to a Collections.BitArray, do I?
Much thanks in advance...
Mike
Visual Basic:
Dim myInt as Integer = 0
myInt = Not myInt
MessageBox.Show(myInt.ToSting) ' <-- Reports -1
Code:
int myInt = 0
myInt = !myInt // <-- Compile Time Error
MessageBox.Show(myInt.ToSting)
Much thanks in advance...
Mike