Gets the value of the bit at a specific position in the BitArray.
Imports System
Imports System.Collections
Imports Microsoft.VisualBasic
Public Class SamplesBitArray
Public Shared Sub Main()
Dim myBA As New BitArray(5)
PrintIndexAndValues(myBA)
' Sets all the elements to true.
myBA.SetAll(True)
PrintIndexAndValues(myBA)
myBA.Set(myBA.Count - 1, False)
PrintIndexAndValues(myBA)
Console.WriteLine(myBA.Get(myBA.Count - 2))
Console.WriteLine(myBA.Get(myBA.Count - 1))
End Sub 'Main
Public Shared Sub PrintIndexAndValues(myCol As IEnumerable)
Dim obj As Object
For Each obj In myCol
Console.WriteLine(obj)
Next obj
End Sub
End Class
Related examples in the same category