Home  |  Delphi .net Home  |  System.Collections.BitArray  |  Get Method
  
Get  
Method  
Gets the BitArray element value at a specific index position
BitArray Class
System.Collections NameSpace
CF1.  Function Get ( Index : Integer ) : Boolean;
CF : Methods with this mark are Compact Framework Compatible
Description
The value of the element at Index position in the current BitArray is returned.
Microsoft MSDN Links
System.Collections
System.Collections.BitArray
 Author links

 Buy Website Traffic at
 Buywebsitetrafficexperts.com

 Buy Proxies at
 Buyproxies.io
 
 
 
A simple example
program Project1;
{$APPTYPE CONSOLE}

uses
  System.Collections;

var
  Bits : System.Collections.BitArray;
  i    : Integer;

begin
  // Create our bit array
  Bits := System.Collections.BitArray.Create(5);

  // Set the values in both arrays
  Bits[0] := false;  // 0
  Bits[1] := true;   // 1
  Bits[2] := true;   // 1
  Bits[3] := false;  // 0
  Bits[4] := false;  // 0

  // Display all bits in the BitArray
  for i := 0 to Bits.Count-1 do
    if Bits.Get(i)
    then Console.WriteLine('Bits [{0}] = 1', i.ToString)
    else Console.WriteLine('Bits [{0}] = 0', i.ToString);

  Console.ReadLine;
end.
   Bits [0] = 0
   Bits [1] = 1
   Bits [2] = 1
   Bits [3] = 0
   Bits [4] = 0
 
 
Delphi Programming Neil Moffatt 2002 - 2017. All rights reserved.  |  Contact the author