In C# I have a BitArray that stores a value of 5 as follows
BitArray bitArray = new BitArray(new int[] { 5});
I want to retrieve the value of 5 from the BitArray as an integer as follows:
int myInt = //some operation on bitArray goes here
What would be a fast method of retrieving it? This operation will be repeated heavily so performance is important.