The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.
BitArray::Not Method ()
.NET Framework (current version)
Inverts all the bit values in the current BitArray, so that elements set to true are changed to false, and elements set to false are changed to true.
Assembly: mscorlib (in mscorlib.dll)
The following code example shows how to apply NOT to a BitArray.
using namespace System; using namespace System::Collections; void PrintValues( IEnumerable^ myList, int myWidth ); int main() { // Creates and initializes two BitArrays of the same size. BitArray^ myBA1 = gcnew BitArray( 4 ); BitArray^ myBA2 = gcnew BitArray( 4 ); myBA1[ 0 ] = false; myBA1[ 1 ] = false; myBA1[ 2 ] = true; myBA1[ 3 ] = true; myBA2[ 0 ] = false; myBA2[ 1 ] = true; myBA2[ 2 ] = false; myBA2[ 3 ] = true; // Performs a bitwise NOT operation between BitArray instances of the same size. Console::WriteLine( "Initial values" ); Console::Write( "myBA1:" ); PrintValues( myBA1, 8 ); Console::Write( "myBA2:" ); PrintValues( myBA2, 8 ); Console::WriteLine(); myBA1->Not(); myBA2->Not(); Console::WriteLine( "After NOT" ); Console::Write( "myBA1:" ); PrintValues( myBA1, 8 ); Console::Write( "myBA2:" ); PrintValues( myBA2, 8 ); Console::WriteLine(); } void PrintValues( IEnumerable^ myList, int myWidth ) { int i = myWidth; IEnumerator^ myEnum = myList->GetEnumerator(); while ( myEnum->MoveNext() ) { Object^ obj = safe_cast<Object^>(myEnum->Current); if ( i <= 0 ) { i = myWidth; Console::WriteLine(); } i--; Console::Write( "{0,8}", obj ); } Console::WriteLine(); } /* This code produces the following output. Initial values myBA1: False False True True myBA2: False True False True After NOT myBA1: True True False False myBA2: True False True False */
Universal Windows Platform
Available since 8
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Available since 8
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Show: