OSS NAS Tools for C# for 5G for 3GPP Release 15.6.0
Oss.Nas.BitString Class Reference

The class provides functionality for the ASN.1 BIT STRING type. BitString can be converted to System.Collections.BitArray using the ToBitArray() method. BitString supports iteration through boolean values using the foreach construction. More...

Inherits IEnumerable< bool >.

Public Member Functions

 BitString (int length)
 Initializes a new instance of the BitString class that can hold the specified number of bit values, which are initially set to false. More...
 
 BitString (BitString value)
 Initializes a new instance of the BitString class that contains bit values copied from the specified BitString. More...
 
 BitString (BitArray bitArray)
 Initializes a new instance of the BitString class that contains bit values copied from the specified BitArray. More...
 
 BitString (bool[] boolArray)
 Initializes a new instance of the BitString class that contains bit values copied from the specified boolean array. More...
 
 BitString (byte[] byteArray, int nbits)
 Initializes a new instance of the BitString class that contains bit values copied from the specified array of bytes. More...
 
 BitString (byte[] byteArray)
 Initializes a new instance of the BitString class that contains bit values copied from the specified array of bytes. More...
 
BitArray ToBitArray ()
 Returns a BitArray that represents the current BitString object. More...
 
BitString And (BitString value)
 Performs the bitwise AND operation on the elements in the current BitString against the corresponding elements in the specified BitString. More...
 
BitString Or (BitString value)
 Performs the bitwise OR operation on the elements in the current BitString against the corresponding elements in the specified BitString. More...
 
BitString Xor (BitString value)
 Performs the bitwise XOR operation on the elements in the current BitString against the corresponding elements in the specified BitString. More...
 
BitString Not ()
 Inverts all the bit values in the current BitString. More...
 
override bool Equals (Object obj)
 BitString objects are equal if they have the same length and identical bit values. More...
 
override int GetHashCode ()
 Gets hash code. More...
 
virtual object Copy ()
 Creates a deep copy of this object. More...
 
IEnumerator< bool > GetEnumerator ()
 Returns an enumerator that iterates through a BitString. More...
 

Properties

byte[] Buffer [get, set]
 Gets or sets a byte array that represents the current BitString object. The bits in the byte array are arranged from left to right, where bit 0 is mapped to byte[0].bit8, bit 1 mapped to byte[0].bit7, etc. More...
 
int Length [get, set]
 Gets or sets the number of elements in a BitArray. When Length is set to a value that is less than Count, BitArray is truncated and the elements located after the Length - 1 value are deleted. When Length is set to a value that is greater than Count, the new elements are set to false. More...
 
bool this[int index] [get, set]
 Gets or sets the value of a bit at a specific position in a BitString. More...
 

Detailed Description

The class provides functionality for the ASN.1 BIT STRING type. BitString can be converted to System.Collections.BitArray using the ToBitArray() method. BitString supports iteration through boolean values using the foreach construction.

Constructor & Destructor Documentation

◆ BitString() [1/6]

Oss.Nas.BitString.BitString ( int  length)
inline

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

Parameters
lengthThe number of bit values in the new BitString.
Exceptions
System.ArgumentExceptionIs thrown when length is less than zero.

◆ BitString() [2/6]

Oss.Nas.BitString.BitString ( BitString  value)
inline

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

Parameters
valueBitString containing the values to copy.

◆ BitString() [3/6]

Oss.Nas.BitString.BitString ( BitArray  bitArray)
inline

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

Parameters
bitArrayBitArray containing the values to copy.

◆ BitString() [4/6]

Oss.Nas.BitString.BitString ( bool[]  boolArray)
inline

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

Parameters
boolArrayA boolean array containing the values to copy.

◆ BitString() [5/6]

Oss.Nas.BitString.BitString ( byte[]  byteArray,
int  nbits 
)
inline

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

Parameters
byteArrayAn array of bytes containing the values to copy. Bits in the byte array are arranged from left to right, where bit 0 is mapped to byte[0].bit8, bit 1 mapped to byte[0].bit7, etc.
nbitsThe number of bits to copy.

◆ BitString() [6/6]

Oss.Nas.BitString.BitString ( byte[]  byteArray)
inline

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

Parameters
byteArrayAn array of bytes containing the values to copy. Bits in the byte array are arranged from left to right, where bit 0 is mapped to byte[0].bit8, bit 1 mapped to byte[0].bit7, etc.

Member Function Documentation

◆ And()

BitString Oss.Nas.BitString.And ( BitString  value)
inline

Performs the bitwise AND operation on the elements in the current BitString against the corresponding elements in the specified BitString.

Parameters
valueBitString with which to perform the bitwise AND operation.
Returns
The current instance containing the result of the bitwise AND operation on the elements in the current BitString against the corresponding elements in the specified BitString.
Exceptions
System.ArgumentExceptionIs thrown when the lengths do not match.

◆ Copy()

virtual object Oss.Nas.BitString.Copy ( )
inlinevirtual

Creates a deep copy of this object.

Returns
A new BitString object with the same value.

◆ Equals()

override bool Oss.Nas.BitString.Equals ( Object  obj)
inline

BitString objects are equal if they have the same length and identical bit values.

Parameters
objBitString to compare.
Returns
True if the specified BitString is equal to the current BitString; otherwise, false.

◆ GetEnumerator()

IEnumerator<bool> Oss.Nas.BitString.GetEnumerator ( )
inline

Returns an enumerator that iterates through a BitString.

Returns
An IEnumerator for the entire BitString.

◆ GetHashCode()

override int Oss.Nas.BitString.GetHashCode ( )
inline

Gets hash code.

Returns
A hash code value.

◆ Not()

BitString Oss.Nas.BitString.Not ( )
inline

Inverts all the bit values in the current BitString.

Returns
The current instance with inverted bit values.

◆ Or()

BitString Oss.Nas.BitString.Or ( BitString  value)
inline

Performs the bitwise OR operation on the elements in the current BitString against the corresponding elements in the specified BitString.

Parameters
valueBitString with which to perform the bitwise OR operation.
Returns
The current instance containing the result of the bitwise OR operation on the elements in the current BitString against the corresponding elements in the specified BitString.
Exceptions
System.ArgumentExceptionIs thrown when the lengths do not match.

◆ ToBitArray()

BitArray Oss.Nas.BitString.ToBitArray ( )
inline

Returns a BitArray that represents the current BitString object.

Returns
A BitArray that represents the current object.

◆ Xor()

BitString Oss.Nas.BitString.Xor ( BitString  value)
inline

Performs the bitwise XOR operation on the elements in the current BitString against the corresponding elements in the specified BitString.

Parameters
valueBitString with which to perform the bitwise XOR operation.
Returns
The current instance containing the result of the bitwise XOR operation on the elements in the current BitString against the corresponding elements in the specified BitString.
Exceptions
System.ArgumentExceptionIs thrown when the lengths do not match.

Property Documentation

◆ Buffer

byte [] Oss.Nas.BitString.Buffer
getset

Gets or sets a byte array that represents the current BitString object. The bits in the byte array are arranged from left to right, where bit 0 is mapped to byte[0].bit8, bit 1 mapped to byte[0].bit7, etc.

◆ Length

int Oss.Nas.BitString.Length
getset

Gets or sets the number of elements in a BitArray. When Length is set to a value that is less than Count, BitArray is truncated and the elements located after the Length - 1 value are deleted. When Length is set to a value that is greater than Count, the new elements are set to false.

◆ this[int index]

bool Oss.Nas.BitString.this[int index]
getset

Gets or sets the value of a bit at a specific position in a BitString.

Parameters
indexThe zero-based index of the value to get or set.
Returns
The value of the bit at position index.
Exceptions
System.IndexOutOfRangeExceptionIs thrown when index is out of range.