Uredi

Deli z drugimi prek


BitArray Constructors

Definition

Initializes a new instance of the BitArray class whose capacity and initial values can be specified.

Overloads

BitArray(Boolean[])

Initializes a new instance of the BitArray class that contains bit values copied from the specified array of Booleans.

BitArray(Byte[])

Initializes a new instance of the BitArray class that contains bit values copied from the specified array of bytes.

BitArray(BitArray)

Initializes a new instance of the BitArray class that contains bit values copied from the specified BitArray.

BitArray(Int32)

Initializes a new instance of the BitArray class that can hold the specified number of bit values, which are initially set to false.

BitArray(Int32[])

Initializes a new instance of the BitArray class that contains bit values copied from the specified array of 32-bit integers.

BitArray(Int32, Boolean)

Initializes a new instance of the BitArray class that can hold the specified number of bit values, which are initially set to the specified value.

BitArray(Boolean[])

Source:
BitArray.cs
Source:
BitArray.cs
Source:
BitArray.cs

Initializes a new instance of the BitArray class that contains bit values copied from the specified array of Booleans.

public:
 BitArray(cli::array <bool> ^ values);
public BitArray (bool[] values);
new System.Collections.BitArray : bool[] -> System.Collections.BitArray
Public Sub New (values As Boolean())

Parameters

values
Boolean[]

An array of Booleans to copy.

Exceptions

values is null.

Remarks

This constructor is an O(n) operation, where n is the number of elements in values.

Applies to

BitArray(Byte[])

Source:
BitArray.cs
Source:
BitArray.cs
Source:
BitArray.cs

Initializes a new instance of the BitArray class that contains bit values copied from the specified array of bytes.

public:
 BitArray(cli::array <System::Byte> ^ bytes);
public BitArray (byte[] bytes);
new System.Collections.BitArray : byte[] -> System.Collections.BitArray
Public Sub New (bytes As Byte())

Parameters

bytes
Byte[]

An array of bytes containing the values to copy, where each byte represents eight consecutive bits.

Exceptions

bytes is null.

The length of bytes is greater than Int32.MaxValue.

Remarks

The first byte in the array represents bits 0 through 7, the second byte represents bits 8 through 15, and so on. The Least Significant Bit of each byte represents the lowest index value: " bytes [0] & 1" represents bit 0, " bytes [0] & 2" represents bit 1, " bytes [0] & 4" represents bit 2, and so on.

This constructor is an O(n) operation, where n is the number of elements in bytes.

Applies to

BitArray(BitArray)

Source:
BitArray.cs
Source:
BitArray.cs
Source:
BitArray.cs

Initializes a new instance of the BitArray class that contains bit values copied from the specified BitArray.

public:
 BitArray(System::Collections::BitArray ^ bits);
public BitArray (System.Collections.BitArray bits);
new System.Collections.BitArray : System.Collections.BitArray -> System.Collections.BitArray
Public Sub New (bits As BitArray)

Parameters

bits
BitArray

The BitArray to copy.

Exceptions

bits is null.

Remarks

This constructor is an O(n) operation, where n is the number of elements in bits.

Applies to

BitArray(Int32)

Source:
BitArray.cs
Source:
BitArray.cs
Source:
BitArray.cs

Initializes a new instance of the BitArray class that can hold the specified number of bit values, which are initially set to false.

public:
 BitArray(int length);
public BitArray (int length);
new System.Collections.BitArray : int -> System.Collections.BitArray
Public Sub New (length As Integer)

Parameters

length
Int32

The number of bit values in the new BitArray.

Exceptions

length is less than zero.

Remarks

This constructor is an O(n) operation, where n is length.

Applies to

BitArray(Int32[])

Source:
BitArray.cs
Source:
BitArray.cs
Source:
BitArray.cs

Initializes a new instance of the BitArray class that contains bit values copied from the specified array of 32-bit integers.

public:
 BitArray(cli::array <int> ^ values);
public BitArray (int[] values);
new System.Collections.BitArray : int[] -> System.Collections.BitArray
Public Sub New (values As Integer())

Parameters

values
Int32[]

An array of integers containing the values to copy, where each integer represents 32 consecutive bits.

Exceptions

values is null.

The length of values is greater than Int32.MaxValue

Remarks

The number in the first values array element represents bits 0 through 31, the second number in the array represents bits 32 through 63, and so on. The Least Significant Bit of each integer represents the lowest index value: " values [0] & 1" represents bit 0, " values [0] & 2" represents bit 1, " values [0] & 4" represents bit 2, and so on.

This constructor is an O(n) operation, where n is the number of elements in values.

Applies to

BitArray(Int32, Boolean)

Source:
BitArray.cs
Source:
BitArray.cs
Source:
BitArray.cs

Initializes a new instance of the BitArray class that can hold the specified number of bit values, which are initially set to the specified value.

public:
 BitArray(int length, bool defaultValue);
public BitArray (int length, bool defaultValue);
new System.Collections.BitArray : int * bool -> System.Collections.BitArray
Public Sub New (length As Integer, defaultValue As Boolean)

Parameters

length
Int32

The number of bit values in the new BitArray.

defaultValue
Boolean

The Boolean value to assign to each bit.

Exceptions

length is less than zero.

Remarks

This constructor is an O(n) operation, where n is length.

Applies to