本文整理匯總了VB.NET中System.Collections.BitArray.Not方法的典型用法代碼示例。如果您正苦於以下問題:VB.NET BitArray.Not方法的具體用法?VB.NET BitArray.Not怎麽用?VB.NET BitArray.Not使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Collections.BitArray
的用法示例。
在下文中一共展示了BitArray.Not方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: Main
' 導入命名空間
Imports System.Collections
Public Class SamplesBitArray
Public Shared Sub Main()
' Creates and initializes two BitArrays of the same size.
Dim myBA1 As New BitArray(4)
Dim myBA2 As New BitArray(4)
myBA1(0) = False
myBA1(1) = False
myBA1(2) = True
myBA1(3) = True
myBA2(0) = False
myBA2(2) = False
myBA2(1) = True
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()
End Sub
Public Shared Sub PrintValues(myList As IEnumerable, myWidth As Integer)
Dim i As Integer = myWidth
Dim obj As [Object]
For Each obj In myList
If i <= 0 Then
i = myWidth
Console.WriteLine()
End If
i -= 1
Console.Write("{0,8}", obj)
Next obj
Console.WriteLine()
End Sub
End Class
輸出:
Initial values myBA1: False False True True myBA2: False True False True After NOT myBA1: True True False False myBA2: True False True False