BitArray.Set Method (Int32, Boolean)


Sets the bit at a specific position in the BitArray to the specified value.

Namespace:   System.Collections
Assembly:  mscorlib (in mscorlib.dll)

member Set : 
        index:int *
        value:bool -> unit


Type: System.Int32

The zero-based index of the bit to set.

Type: System.Boolean

The Boolean value to assign to the bit.

Exception Condition

index is less than zero.


index is greater than or equal to the number of elements in the BitArray.

This method is an O(1) operation.

The following code example shows how to set and get specific elements in a BitArray.

No code example is currently available or this language may not be supported.

Universal Windows Platform
Available since 8
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Return to top